View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default rng(1,1) syntax doesn't work for set rng = arange.columns(1)

Not sure this is a totally satisfactory explanation, but here's my
best guess. Look at

? Range("B2:B5").Cells.Count, Range("B2:B5").Columns(1).Count
4 1

When you reference the column property, it returns a unit rather
than a range of cells.

Since the

rng(1, 1)

syntax is shorthand for

rng.item(rowindex, columnindex)

syntax, my best guess is that specifying a rowindex is ambiguous and
therefore returns the error.

In article ,
"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