Link to home
Start Free TrialLog in
Avatar of camper12
camper12

asked on

last row

Hi,

I am using the following to get the last row of a column:
lastRowClass2 = ActiveSheet.Range("D" & Rows.Count).End(xlUp).Row

I want to modify this a bit and find the last row only in a particular range such as D1:D20. I do not want to consider values that are beyond row 20.

How can I do that?

Thanks
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

lastRowClass2 =  Range("D1:D20").Row + Range("D1:D20").Rows.Count - 1
But then again it's always 20 isn't it?
Avatar of camper12
camper12

ASKER

Sorry, I want to find the first blank and its corresponding row number in range  D1:D20

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015