Hi Guys
I am new to VBA trying to create a macro to copy some data from sheet2 (we can have any number of rows in this data it’s not fixed) and paste it to sheet1. Attached is sample data file. I need to copy data from sheet 2 to sheet1.
Data from column A to C (sheet2) needs to go to first empty cells in column C to E (sheet 1)
Data from column G to N (sheet2) needs to go to first empty cells in column I to P (sheet 1)
Data from column AC (sheet2) needs to go to first empty cells in column A E (sheet 1)
And then in (A, B & Q to AD) columns copy and paste the formula from above cells.
Just to explain a little more data in sheet2 didn’t had any blank columns actually I inserted these blank columns to match it with sheet1 I thought that might help in copy paste using below code but it isn’t working, any help would be much appreciated:
Sub copydata()
Dim lr, lc
lr = Sheets("sheet2").Cells(Rows.Count, 29).End(xlUp).Row
lc = Sheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
Sheets("sheet2").Range("A2:AC" & lr).Copy Destination:=Sheets("sheet1").Cells(lc, 3)
End Sub
Bookmarks