Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Understanding Resize Method
Why does using the Resize Method below return a cell address of $M$2? I
would have thought it would keep the addres the same. Also, why does it absolute the range? revrangeaddress = Range("M2:M13").Resize(1, 1).Address Thanks EM |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Understanding Resize Method
Hi Excel Monkey..
The expression: Range("M2:M13").Resize(1, 1). will return a ramge, anchored in the firrst cell of the host range, which is one one row long and one column wide. i.e. a single cell. --- Regards. Norman "ExcelMonkey" wrote in message ... Why does using the Resize Method below return a cell address of $M$2? I would have thought it would keep the addres the same. Also, why does it absolute the range? revrangeaddress = Range("M2:M13").Resize(1, 1).Address Thanks EM |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Understanding Resize Method
You have a couple of questions...
1. Why do you get $M$2 as your result. Resize can be used to expand or contract a range. To that end it uses the upper left corner of the range as the starting point and allows you to resize from that starting point. To get the same size you would want... with Range("M2:M13") revrangeaddress = .Resize(.rows, .columns).Address end with 2. Why absolute? Address always returns an absolute. If you need the $ signs removed you can just use the substitute function. -- HTH... Jim Thomlinson "ExcelMonkey" wrote: Why does using the Resize Method below return a cell address of $M$2? I would have thought it would keep the addres the same. Also, why does it absolute the range? revrangeaddress = Range("M2:M13").Resize(1, 1).Address Thanks EM |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Understanding Resize Method
On Jun 2, 12:53*pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote: You have a couple of questions... 1. Why do you get $M$2 as your result. Resize can be used to expand or contract a range. To that end it uses the upper left corner of the range as the starting point and allows you to resize from that starting point. To get the same size you would want... with Range("M2:M13") revrangeaddress = .Resize(.rows, .columns).Address end with 2. Why absolute? Address always returns an absolute. If you need the $ signs removed you can just use the substitute function. -- HTH... Jim Thomlinson "ExcelMonkey" wrote: Why does using the Resize Method below return a cell address of $M$2? *I would have thought it would keep the addres the same. *Also, why does it absolute the range? revrangeaddress = Range("M2:M13").Resize(1, 1).Address Thanks EM- Hide quoted text - - Show quoted text - Nice explanation Jim. Only thing I will add is that you don't have to use the Substitute function to get rid of the absolute references. Just add False, False to the Address. revrangeaddress = Range("M2:M13").Resize(1, 1).Address(False, False) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Understanding Resize Method
Thanks for pointing that out. A much better solution.
-- HTH... Jim Thomlinson "JW" wrote: On Jun 2, 12:53 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move- This-.com wrote: You have a couple of questions... 1. Why do you get $M$2 as your result. Resize can be used to expand or contract a range. To that end it uses the upper left corner of the range as the starting point and allows you to resize from that starting point. To get the same size you would want... with Range("M2:M13") revrangeaddress = .Resize(.rows, .columns).Address end with 2. Why absolute? Address always returns an absolute. If you need the $ signs removed you can just use the substitute function. -- HTH... Jim Thomlinson "ExcelMonkey" wrote: Why does using the Resize Method below return a cell address of $M$2? I would have thought it would keep the addres the same. Also, why does it absolute the range? revrangeaddress = Range("M2:M13").Resize(1, 1).Address Thanks EM- Hide quoted text - - Show quoted text - Nice explanation Jim. Only thing I will add is that you don't have to use the Substitute function to get rid of the absolute references. Just add False, False to the Address. revrangeaddress = Range("M2:M13").Resize(1, 1).Address(False, False) |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Understanding Resize Method
Thanks to all you responded.
EM "Norman Jones" wrote: Hi Excel Monkey.. The expression: Range("M2:M13").Resize(1, 1). will return a ramge, anchored in the firrst cell of the host range, which is one one row long and one column wide. i.e. a single cell. --- Regards. Norman "ExcelMonkey" wrote in message ... Why does using the Resize Method below return a cell address of $M$2? I would have thought it would keep the addres the same. Also, why does it absolute the range? revrangeaddress = Range("M2:M13").Resize(1, 1).Address Thanks EM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
Resize method fails for 1-D array? | Excel Programming | |||
copy cell after resize method in VBA | Excel Programming | |||
resize method | Excel Programming |