Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Question on Macros in 2007 | Excel Discussion (Misc queries) | |||
Question about macros. | Excel Discussion (Misc queries) | |||
Question about merging macros | Excel Worksheet Functions | |||
Macros/Signatures Question | New Users to Excel | |||
question macros | Excel Worksheet Functions |