Select Variable Range paste last row + 1

  • Thread starter Thread starter SteveT
  • Start date Start date
S

SteveT

Hello,

Looking for macro solution to perform following

1) Copy Variable Range (A2:C?) from source.xls
2) Paste Range to last row + 1 destination.xls

There are many posts concerning but none are performing task needed.
Ron de Bruin's solution in posting "copy & paste macro" has come closest but
I continually get compile error.

Thanks in advance for any assistance.

BR,

Steven
 
Dim RngToCopy as range
dim DestCell as range

with workbooks("source.xls").worksheets("somesheetnamehere")
set rngtocopy = .range("A2:C" & .cells(.rows.count,"A").end(xlup).row)
end with

with workbooks("Destination.xls").worksheets("someothersheetnamehere")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

rngtocopy.copy _
destination:=destcell



The code depends on the last used cell in column A for both ranges.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top