PDA

View Full Version : more than 2 dims in an array?



choubix
06-02-2008, 07:04 PM
hello,

I am used to php programmign more than vba.
in php you can declare more than 2 dims arrays.

is it possible with VBA?
I found info for arrays with a max dimension of 2.

what I need to do is:

open a workbook, in a specific worksheet, check in a column (let's say E) if there is a conditional formatting, if there is a conditional formatting, select data in the same row but in different columns (let's say A, D, F ang G)

is it possible with an array??

thanks

mikerickson
06-02-2008, 07:27 PM
You can have large dimesioned arrays in VB.
Dim myArray(1 to 10, 1 to 20, 7 to 9, 1 to 4)

In the case you mention, I'm not clear why you would want more than 2 dimensions.

one row of data; Array(A1, D1, F1, G1) is a one dimensional array

one sheet of data; myArray(1 to Rows.Count, 1 to 4) is a two dimensional array

myArray(1,1) = A1 , myArray(1,2) = D1, myArray(1,3) = F1, myArray(1,4) = G1
myArray(2,1)= A2, etc

I don't see the need for a third index to the array.

choubix
06-02-2008, 08:26 PM
hi mike, ok I think I get the idea. thanks