Reputation: 1494
I am using this code to get the last used rows-
rowNo=objExcel.Activeworkbook.Sheets(1).UsedRange.Rows.count
Now, i want to copy the data of a specific column upto last row used.
//What to write in the below code to use rowNo //
Set Source=objExcel.Activeworkbook.Sheets(1).Column("G")
Source.Copy
Upvotes: 1
Views: 6083
Reputation: 149335
That's the incorrect way to find the last row. See the link on how to find the last row.
Once you have found the last row then simply use this code to copy
ws.Range("G1:G" & rowNo).Copy
Where ws
is the worksheet object.
Upvotes: 1