msquared99
Board Regular
- Joined
- Mar 8, 2012
- Messages
- 52
I have been trying to figure out how to copy specific columns with variable rows to a new workbook. My raw data workbook has data in columns A:Y. My macro (which is a stand alone) sorts on column R to get the data I want to copy at the top.
What I want to do is copy columns A, C, R:T rows 2:lastRow, where lastRow is a variable, into my master template in columns A:E. Sometimes the rows in the raw data workbook could be 10 rows and other times it could be 50 rows. Row 1 has column headers in it.
Example:
Workbooks("Raw Data").Worksheets(1).Activate
Worksheets(1).Range("A2:A", "C2:C", "R2:T" & lastRow).Copy _
Destination:=Workbooks("Master Template").Worksheets("Delivery").Range("A5")
Many thanks!
What I want to do is copy columns A, C, R:T rows 2:lastRow, where lastRow is a variable, into my master template in columns A:E. Sometimes the rows in the raw data workbook could be 10 rows and other times it could be 50 rows. Row 1 has column headers in it.
Example:
Workbooks("Raw Data").Worksheets(1).Activate
Worksheets(1).Range("A2:A", "C2:C", "R2:T" & lastRow).Copy _
Destination:=Workbooks("Master Template").Worksheets("Delivery").Range("A5")
Many thanks!