![]() |
Question on Macros
I have a macro that is moving data from on sheet to another.
For example the macro below will move everything that is in l51down to n2. Sheets("sheet1").Range("l51:l" & Trim(Str(20 + iRows))).Copy Sheets("sheet3").Range("n2:n" & Trim(Str(3 + iRows))).PasteSpecial Paste:=xlPasteValues How can I move more data to sheet 3 that will automatically put the data in the last row where the previous data was placed? Thanks |
Question on Macros
I think you mean the first empty row? Either put the data in LastRow or
NewRow. with Sheets("Sheet3") LastRow = .Range("n" & Row.Count).end(xlup).row NewRow = LastRow + 1 Sheets("sheet1").Range("l51:l" & Trim(Str(20 + iRows))).Copy .Range("n2:n" & NewRow).PasteSpecial Paste:=xlPasteValues "Juan Carlos" wrote: I have a macro that is moving data from on sheet to another. For example the macro below will move everything that is in l51down to n2. Sheets("sheet1").Range("l51:l" & Trim(Str(20 + iRows))).Copy Sheets("sheet3").Range("n2:n" & Trim(Str(3 + iRows))).PasteSpecial Paste:=xlPasteValues How can I move more data to sheet 3 that will automatically put the data in the last row where the previous data was placed? Thanks |
Question on Macros
Dim DestCell as range
With worksheets("Sheet3") set destcell = .cells(.rows.count,"N").end(xlup).offset(1,0) end with worksheets("sheet1").range("L51:L" & 20 + irows).copy destcell.pastespecial paste:=xlpastevalues (VBA is very forgiving. You don't need the trim(str()) stuff.) Juan Carlos wrote: I have a macro that is moving data from on sheet to another. For example the macro below will move everything that is in l51down to n2. Sheets("sheet1").Range("l51:l" & Trim(Str(20 + iRows))).Copy Sheets("sheet3").Range("n2:n" & Trim(Str(3 + iRows))).PasteSpecial Paste:=xlPasteValues How can I move more data to sheet 3 that will automatically put the data in the last row where the previous data was placed? Thanks -- Dave Peterson |
All times are GMT +1. The time now is 01:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com