View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default How to set range

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)


"Judy Ward" wrote in message
...
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