Sub Test()
Const vWhat As Double = 1.234
Const iLB1 As Long = -100
Const iUB1 As Long = 200
Const iLB2 As Long = 200
Const iUB2 As Long = 500
Dim av(iLB1 To iUB1, iLB2 To iUB2) As String
Dim v As Variant
Debug.Print Timer
av(iUB1, iUB2) = vWhat
v = FindVal1(vWhat, av)
Debug.Print Timer, v(0), v(1), av(v(0), v(1))
v = FindVal2(vWhat, av)
Debug.Print Timer, v(0), v(1), av(v(0), v(1))
End Sub
Function FindVal1(sWhat As String, av As Variant) As Variant
Dim iLB1 As Long
Dim iUB1 As Long
Dim iLB2 As Long
Dim iUB2 As Long
Dim i As Long
Dim v As Variant
iLB1 = LBound(av, 1)
iUB1 = UBound(av, 1)
iLB2 = LBound(av, 2)
iUB2 = UBound(av, 2)
With Application
If iUB1 - iLB1 > iUB2 - iLB2 Then
For i = iLB2 To iUB2
v = .Match(sWhat, .Index(av, 0, i - iLB2 + 1), 0)
If Not IsError(v) Then
FindVal1 = Array(CLng(v + iLB1 - 1), i)
Exit Function
End If
Next i
Else
For i = iLB1 To iUB1
v = .Match(sWhat, .Index(av, i - iLB1 + 1, 0), 0)
If Not IsError(v) Then
FindVal1 = Array(i, CLng(v + iLB2 - 1))
Exit Function
End If
Next i
End If
End With
End Function
Function FindVal2(sWhat As String, av As Variant) As Variant
Dim i As Long
Dim j As Long
For i = LBound(av, 1) To UBound(av, 1)
For j = LBound(av, 2) To UBound(av, 2)
If av(i, j) = sWhat Then
FindVal2 = Array(i, j)
End If
Next j
Next i
End Function