Question : Array and Loop example in Excel 2007 VBA

I am looking for a simple way to extract data from a 2-d array variable in Excel 2007, vba.
Looking at the code below, how would I extract the corresponding value for "YELLOW"?
Thank you!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Dim arr(3,3) as string, x as string
arr(1,1)="BLUE"
arr(2,1)="YELLOW"
arr(3,1)="RED"
arr(2,1)="1"
arr(2,2)="2"
arr(2,3)="3"

some code to make magic happen
x = results of magic
end sub

Answer : Array and Loop example in Excel 2007 VBA

Your array does not make sense.

I suspect you wanted this?

Dim arr(1 To 3, 1 To 2) As String, x As String
arr(1, 1) = "BLUE"
arr(2, 1) = "YELLOW"
arr(3, 1) = "RED"
arr(1, 2) = "1"
arr(2, 2) = "2"
arr(3, 2) = "3"
Random Solutions  
 
programming4us programming4us