ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set Range variable to point to End(xlDown) cell? (https://www.excelbanter.com/excel-programming/405734-how-set-range-variable-point-end-xldown-cell.html)

[email protected]

How to set Range variable to point to End(xlDown) cell?
 
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)

Per Jessen

How to set Range variable to point to End(xlDown) cell?
 
Set rng = Range("C3").End(xlDown)

// Per

skrev i en meddelelse
...
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)




Ron Rosenfeld

How to set Range variable to point to End(xlDown) cell?
 
On Thu, 7 Feb 2008 06:08:41 -0800 (PST), wrote:

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

[email protected]

How to set Range variable to point to End(xlDown) cell?
 
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

On Feb 7, 2:08*pm, wrote:
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)



[email protected]

How to set Range variable to point to End(xlDown) cell?
 
On Feb 7, 6:18*am, Ron Rosenfeld wrote:
On Thu, 7 Feb 2008 06:08:41 -0800 (PST), wrote:
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)


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)`.


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com