View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
michdenis michdenis is offline
external usenet poster
 
Posts: 135
Default Array of Values from Worksheet Range - What does it 'look' like?

Hi alan,

This way,


dim rangearray as variant
dim MyArray as variant

rangearray = Range("Names")
MyArray = Array("Alan", "Bob", "Charles")

Both ways gave the same result.


Salutations!





"Alan" a écrit dans le message de ...

Hi All,

Can anyone explain why these are not equal:

RangeArray = Array(Range("Names").Value)

MyArray = Array("Alan", "Bob", "Charles")


The worksheet range name 'Names' contains three cells (A1, A2, A3)
with "Alan", "Bob", and "Charles" in respectively.


I am thinking that perhaps the first expression is a single element
array, that contains a (sub)array with three elements, whereas the
second is an array of three elements. I am getting this from
examining the locals window, but I admit I don't fully understand what
I am seeing there.


More specifically, how do I change the first expression to evaluate
exactly equal to the second?

Thanks,

Alan.