View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Stefano Gatto Stefano Gatto is offline
external usenet poster
 
Posts: 59
Default Is really the default property consistently returned/assigned?

I wrote a procedure a bit like this:

For Each rngCell in rngEmployees
lstEmployees.Additem rngCell
Next rngCell

rngEmployees is a one-column range filled with employee's names.

This code is trivial and I have been doing it for 10 years without problems.
Today for the first time a colleague executing this piece of code calls me
and shows me that an error is raised with the .Additem method (Type
mismatch). The debugger says rngCell is definitely a string (like "Joe
Smith"), not a number, nor anything else.

The strange thing is that it works well on my computer.

When I change
lstEmployees.Additem rngCell
into
lstEmployees.Additem rngCell.Value

then it works on both computers.

Can someone explain me this? Isn't it that .value is the default property of
the Range class?

I am really really lost!

Many thanks and have a good day.

Stefano Gatto