View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Judy Ward Judy Ward is offline
external usenet poster
 
Posts: 45
Default How to set range

Thank you very much, this works for me.

"Jim Thomlinson" wrote:

Change
Set r = Range("L2", "L50")
to
Set r = Range("L2", Range("L65536").End(xlUp))

--
HTH...

Jim Thomlinson


"Judy Ward" wrote:

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