msquared99
Member
I had a situation where my raw data workbook contained data in columns A:Y. In column R, the data could vary from 5 to several hundred rows and was the only row where if sorted, data would be in only say 50 of 100 rows. The column R data was what I was interested in. So, how do I copy only columns A, C and R to the last row in column R and put it into my master workbook in columns A:C? My macro first sorts by column R.
Solution:
'Application.Union(Range("A2:A" & lastRow),Range("C2:C" & lastRow),Range("R2:R" & lastRow)).Copy _
Destination:=Workbooks("Master.xlsx").Sheets("Data").Range("A2")'
Not sure if anyone else has this same situation but this code works well.
Solution:
'Application.Union(Range("A2:A" & lastRow),Range("C2:C" & lastRow),Range("R2:R" & lastRow)).Copy _
Destination:=Workbooks("Master.xlsx").Sheets("Data").Range("A2")'
Not sure if anyone else has this same situation but this code works well.