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

You have a column object:

? Range("B2:X5").Columns(1).count
1

See, the count is 1

Adding cells drills into the cells within the column object:
? Range("B2:X5").Columns(1).cells.count
4

so adding cells refers to B2:B5 as individual cells while the original
refers to the 1st column in B2:X5.

--
Regards,
Tom Ogilvy


"Tim Zych" wrote in message
...
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