View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Eric White[_2_] Eric White[_2_] is offline
external usenet poster
 
Posts: 45
Default Array function, two dimensions?? and worksheet arrays

Q1) Can you 'do' exampleA in two dimensions?

Yes, if you Dim the 2-D array as a variant. Only variants can hold
arrays... even arrays of arrays.

Q2) the Excel text for example A says that 10,20,30 arglist are values.
Can what's inside the parenthesis be variable names containing values?


No. Only values can be stored using the "Array" identifier. However, you
can store objects that are "pointers" to values. For example,

Dim arr(0 To 1) As Variant 'Variant array
Dim i As Integer
Dim j As Integer

arr(0) = Array(Range("a1"), Range("b2"), Range("c3")) 'Range of cells,
arr(1) = Array(Range("a2"), Range("b3"), Range("c4")) 'not their values

For i = 0 To 1
For j = 0 To 2
Debug.Print arr(i)(j).Value 'This works! Boy, was I surprised!
Next j
Next i

Q3) New topic:
I can't seem to find an example of how to specify an array of cells
for worksheet formulas (NOT a vba array)
will you provide a brief example?


Not quite sure what you mean here. Are you talking about array formulas in
Excel? Lookup the FormulaArray property in VBA help. Note that you have to
use R1C1 nomenclature in the formulae in this instance.