Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am looking for code that automatically defines/names a range which changes
each month. Also I need the code which identifies the location of the last cell in the range. |
#2
![]() |
|||
|
|||
![]()
Not knowing what your range looks like I'll assume you want a range starting
at A1 and going down to the last occupied cell in Column A. I'll also assume you want to name this range "MyRange". To define and name the range, use: Range("A1", Range("A" & Rows.Count).End(xlUp)).Name = "MyRange" The cell address of the last occupied cell in Column A is: Range("A" & Rows.Count).Address If you want to use the range name in identifying the last cell of the range, use: Range("MyRange")(Range("MyRange").Count).Address HTH Otto "Ant" wrote in message ... I am looking for code that automatically defines/names a range which changes each month. Also I need the code which identifies the location of the last cell in the range. |
#3
![]() |
|||
|
|||
![]()
Thanks Otto. That works well. If my range goes across to say column H, how do
I incorporate this into the formula below. I tried Range("A1", Range("A1:H1" & Rows... but it debugged. "Otto Moehrbach" wrote: Not knowing what your range looks like I'll assume you want a range starting at A1 and going down to the last occupied cell in Column A. I'll also assume you want to name this range "MyRange". To define and name the range, use: Range("A1", Range("A" & Rows.Count).End(xlUp)).Name = "MyRange" The cell address of the last occupied cell in Column A is: Range("A" & Rows.Count).Address If you want to use the range name in identifying the last cell of the range, use: Range("MyRange")(Range("MyRange").Count).Address HTH Otto "Ant" wrote in message ... I am looking for code that automatically defines/names a range which changes each month. Also I need the code which identifies the location of the last cell in the range. |
#4
![]() |
|||
|
|||
![]()
Range("A1", Range("H" & Rows.Count).End(xlUp)).Name = "MyRange"
HTH Otto "Ant" wrote in message ... Thanks Otto. That works well. If my range goes across to say column H, how do I incorporate this into the formula below. I tried Range("A1", Range("A1:H1" & Rows... but it debugged. "Otto Moehrbach" wrote: Not knowing what your range looks like I'll assume you want a range starting at A1 and going down to the last occupied cell in Column A. I'll also assume you want to name this range "MyRange". To define and name the range, use: Range("A1", Range("A" & Rows.Count).End(xlUp)).Name = "MyRange" The cell address of the last occupied cell in Column A is: Range("A" & Rows.Count).Address If you want to use the range name in identifying the last cell of the range, use: Range("MyRange")(Range("MyRange").Count).Address HTH Otto "Ant" wrote in message ... I am looking for code that automatically defines/names a range which changes each month. Also I need the code which identifies the location of the last cell in the range. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help PLEASE! Not sure what answer is: Match? Index? Other? | Excel Worksheet Functions | |||
Define range for graphs/charts with validation list | Excel Discussion (Misc queries) | |||
Macro - define cell range for a sum function | Excel Discussion (Misc queries) | |||
Define a range based on another named range | Excel Worksheet Functions | |||
Define Range with an offset | Excel Discussion (Misc queries) |