Okay, so I have a sheet that I need to be able to copy the information from Columns B through CC and paste them into another workbook in columns A through CB in row 2.
The first 7 rows are headers, so if there are 5 lines of data, the Range to copy would be B8:CC12. So the only unknown is the number of rows in column CC.
Can I write a macro that will find the last row of data on the sheet and use the number of that row in the range to copy?
Any advice would be greatly appreciated.
Thanks in advance!
-Amy Kate
Something along these lines, adjust sheet reference as required:Can I write a macro that will find the last row of data on the sheet and use the number of that row in the range to copy?
Code:Dim lrow As Long lrow = Sheet1.Cells(lrow, "CC").End(xlUp).Row range("B8:CC" & lrow).Copy
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
Try something like:
The in your copy range you want something like Range("B8:CC" & C.Row)Code:Dim C As Range Set C = Range("B:CC").SpecialCells(xlLastCell) 'put the rest of your code here
Ah, you rock!
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks