How to set Range variable to point to End(xlDown) cell?

  • Thread starter curiousgeorge408
  • Start date
C

curiousgeorge408

What's the best way to set a Range variable to point to the
End(xlDown) cell?

The following seems to do the job. But can this be improved?

Dim rng as Range
Set rng = Range(Range("C3").End(xlDown).Address)
 
R

Ron Rosenfeld

What's the best way to set a Range variable to point to the
End(xlDown) cell?

The following seems to do the job. But can this be improved?

Dim rng as Range
Set rng = Range(Range("C3").End(xlDown).Address)


Rather:

Dim c As Range
Set c = Range("c3").End(xlDown)

Debug.Print c.Address
--ron
 
P

paul.robinson

Hi
This is the same as
Set rng = Range("C3").End(xlDown)

If the data you are processing has gaps below C3 then you might use

Set rng = Range("C65536").End(xlup)

to identify the last cell with data below C3. The first method will
stop above the first blank cell .
regards
Paul
 
C

curiousgeorge408

Rather:
Dim c As Range
Set c = Range("c3").End(xlDown)

Thanks to all who pointed this out. Klunk! I misread the Help page,
then I proceeded to confuse myself when I did `debug.print
range("c3").end(xldown)`.
 

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