ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Strange behaviour of default property (https://www.excelbanter.com/excel-programming/279409-re-strange-behaviour-default-property.html)

Vasant Nanavati

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






All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com