LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default rng(1,1) syntax doesn't work for set rng = arange.columns(1)

In your code, the indices in rng(1,1) are trying to refer the Column
number, and there is no Column numbered 1,1.

To see how the indices work, code

Set rng = Range("B2:X5").Columns
Debug.Print rng(3).Address

You will see that the index to the rng variable is referring not to the
3rd cell of anything, but to the third Column, $C$2:$C$5.

And since this syntax is iterative, rng(3)(2) would refer to the 4th
Column; i.e., the 2nd column starting from rng(3), $D$2:$D$5.

Alan Beban

Tim Zych wrote:
Anybody know why this doesn't work?

Dim rng As Range
Set rng = Range("B2:X5").Columns(1)
Debug.Print rng.Address '<- this works
Debug.Print rng(1, 1).Address '<-this doesn't

Yes, rng.cells(1,1) does work. What's up with this?

XL2000, Win2000


 
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
Using Macro how to create email link for the email addresses in aRange or Selection Satish[_2_] Excel Worksheet Functions 8 December 28th 09 03:30 PM
Arange sorted data in multiple columns Unknown Excel Discussion (Misc queries) 6 September 6th 07 03:59 AM
Help to adapt Formula syntax to work with Visible Filtered Cells Sam via OfficeKB.com Excel Worksheet Functions 6 September 16th 05 11:42 PM
Help to adapt Formula syntax to work with Dynamic Named Ranges Sam via OfficeKB.com Excel Worksheet Functions 13 April 29th 05 12:36 AM
arange dates kabeer Excel Discussion (Misc queries) 1 April 8th 05 03:15 AM


All times are GMT +1. The time now is 11:59 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"