View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Strange behaviour of default property

Hi Mikhail:

It may depend on how the range rFeedType is defined. Cells is not always the
default property of a range. See this recent discussion:

http://google.com/groups?hl=en&lr=&i...GP12.phx.g bl

Regards,

Vasant.


"Mikhail" wrote in message
...
I have copied an example from Mr. Walkenbach website about how to fill a
listbox with non-duplicated values.
we declare a collection and fiil it with values from a range. rFeedType is
declared as range
Dim rFeedType as Range
Dim NoDupes as New Collection

On Error Resume Next
For Each Cell In rFeedType.Cells 'if I write For Each Cell In rFeedType
'<- this line causes problem if.Cells is removed.
NoDupes.Add Cell.Value, CStr(Cell.Value)
Next Cell

'Resume normal error handling
On Error GoTo 0

If I write For Each Cell In rFeedType the ListBox becomes empty
In original example .Cells is not used. Sometimes it works without .Cells
OK.
Is it some glitch in Excel itself?

TIA, Mike510