Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default 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
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
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 4 June 6th 06 04:46 AM
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 0 March 15th 06 10:34 AM
Resize method fails for 1-D array? quartz[_2_] Excel Programming 6 December 6th 05 01:29 PM
copy cell after resize method in VBA norika Excel Programming 0 June 22nd 05 05:03 AM
resize method Tim McPhillips Excel Programming 3 August 11th 03 10:43 PM


All times are GMT +1. The time now is 09:55 PM.

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

About Us

"It's about Microsoft Excel"