Excel VBA

Excel VBA

Didn't find your answer?

and every time I update an entry on this sheet, it will have to copy and paste as value the invoice amount in the other sheet (within the same file)

Please help me to write the code for this.

Thank you for your time

Regards

Siva

Replies (1)

Please login or register to join the discussion.

avatar
By paulwakefield1
31st Jul 2008 10:30

The beginnings of an answer
Here is a very basic routine to get you started.

Private Sub Worksheet_Change(ByVal Target As Range)

Selection.Copy
Sheet2.Range("a1").PasteSpecial Paste:=xlPasteValues

End Sub

Paste the above code into the vba code area for the source worksheet.

All it does at the moment is take any change on your first worksheet and paste its value into cell A1 on the second worksheet. So you will need to play with the destination ranges to suit your partcular needs and also limit which changed cells on the source sheet are allowed to update the second sheet.

Note: Sheet2 above is NOT the sheet name on the tab but the name given to the sheet in the project properties window (before the brackets). This has the advantage of not compromising the code if the sheet name changes.

Thanks (0)