View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
TH[_3_] TH[_3_] is offline
external usenet poster
 
Posts: 38
Default Referring to Microsoft Excel array in VBA

I don't follow your 4;3;4;3;2;5, but if you have defined a Name on the
worksheet it is referred simply as:

Range("MyArray")

assuming there are not duplicate names on multiple sheets.
If there are it would be:

Worksheets("MySheet").Range("MyArray")

Now that gets the entire array. If you want each cell separately try:

Set MyList = Range("MyArray")
For each C in MyList
if C.value = "???" Then
'do something
end if
Next

The above cycles through each cell in the array so you can do compares,
assigns, whatever.

TH

On 4/21/04 15:58, in article , "Alan
Beban" wrote:

I have a defined name, "MyArray". It refers to the array 4;3;4;3;2;5.
How do I refer to MyArray in VBA code?

TIA,
Alan Beban