Copy data from current work to another [Solved/Closed]

Report
Posts
1
Registration date
Tuesday February 11, 2014
Status
Member
Last seen
February 11, 2014
-
 Sush -
Hi All,

Please can you help me with the VBA code which copies columns from current active workbook to another closed workbook at the end of rows... bcoz my closed workbook has lot of data with same details of members

My Data is

Name Address Age User
Sushil PCMC 21 SSC

1 reply

Posts
2669
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
October 15, 2020
446
Hi Sushil,

The following code will copy the data from the active workbook (columns A:D minus the header row). Then a closed workbook of your choosing will be opened. Copied data will be pasted in the first available row. Workbook will be closed and changes will be saved.

Sub RunMe()
Dim lRow As Integer

lRow = Range("A1").End(xlDown).Row

Range("A2:D" & lRow).Copy
Workbooks.Open "C:\MyFiles\Test.xls" 'Change file path to match yours
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
ActiveWorkbook.Close SaveChanges:=True

Application.CutCopyMode = False
End Sub

Best regards,
Trowa
That was really help full , Thank you very much its great