Code macro how to select used rows of a column

Closed
Kevin - Dec 16, 2015 at 11:19 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Dec 21, 2015 at 11:02 AM
Hello everybody,

I'm struggle with my macro code. I would like to copy data to a worksheet and paste them to another.
My problem is everyday the data could be different.

Below this is the code I'm using. I found a way bu that means I copy 20000 rows whereas I could have only 20 rows to copy.

Windows("fitment.xls").Activate
Range("A1:I20000").Select
Range("I20000").Activate
Selection.Copy
Windows("portbury_extract_technical.xlsm").Activate
Sheets("fitment executed").Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False


Thank you for your help...
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Dec 21, 2015 at 11:02 AM
Hi Kevin,

Instead of using:
Range("I20000").Activate
Try this:
Range("I2:I"&cells(rows.count,"I").end(xlup).row).activate

Best regards,
Trowa
0