How to set range

G

Guest

I want to loop through the range of cells that have data. I know how to do
this with a "hard-coded" range:
Set r = Range("L2", "L50")
For n = 1 To r.Rows.coutn
<my code here>
Next n

My problem is that I may have more (or less) than 50 rows. How can I set r
equal to rows 2 through the last row with data (I don't want to perform the
code on the first row).

Thank you for your help,
Judy
 
B

Bob Phillips

For n = 1 To Cells(Rows.Count,"A").End(xlUp).Row
<my code here>
Next n

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top