Finding last row for data starting from cell A10

nadeem505

New Member
Joined
Jun 21, 2012
Messages
33
Hi Folks,

I am trying to run a macro to find last row in column A and paste the value in column H:J. I am copying value from another workbook (OldWkb) and copying it in to new workbook. (NewWkb)

My data starts from cell A10. I have left some space at the top to insert some pictures. Is it possible to find the last row for data starting from A10?

I am using this code but gives me "Run-time error '9': Subscript out of range"

Lrow = NewWkb.wks.Range("A10").CurrentRegion.Rows.Count - 'Macro drops on this line
OldWkb.ws.Range("C2:E2").Value = NewWkb.wks.Range("H" & Lrow & ":J" & Lrow).Value

Any help is much appreciated.

Please let me know if I am not clear enough.

Regards

NK
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
To find the last row in Column A, I use the following code:

Code:
Range("A" & rows.count).end(xlup).row

precede the code with any worksheets required
 
Upvote 0
Thanks, Alan.

Yes I have used this code in most of my other files. It works. But this one it drops because the data is starting in cell A10 rather than A1.

I just tried your code again to make sure but still getting the same run-time error. :(

Cheers
 
Upvote 0
You can put your complete code to see the other variables
 
Upvote 0
Try
Code:
[COLOR=#FF0000]Lrow = NewWkb.wks.Range("A" & rows.count).end(xlup).row
[/COLOR]if Lrow < 10 then Lrow = 10
 
Upvote 0
Thanks, Dante and Alan.

Solved.

I hadn't declared my "NewWkb" variable properly. It worked with ActiveSheet. Will change that now.

Cheers,

NK
 
Upvote 0
Thanks, Dante and Alan.

Solved.

I hadn't declared my "NewWkb" variable properly. It worked with ActiveSheet. Will change that now.

Cheers,

NK

Im glad to help you, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,323
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top