Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default 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)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default 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)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default 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)`.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use xldown to select a range of cells merry_fay Excel Discussion (Misc queries) 3 May 26th 09 05:54 PM
End(xldown) not always going to last cell? Duncan[_5_] Excel Programming 6 May 4th 06 10:30 AM
Unable to use Range.End(xlDown) method vedpatel Excel Programming 6 March 1st 06 04:18 AM
Unable to get last filled cell address from Range.End(xlDown) method vedpatel[_2_] Excel Programming 1 February 28th 06 09:09 AM
Select the next row after xldown range ExcelMonkey[_108_] Excel Programming 2 March 5th 04 10:03 PM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"