E
Excel Monkey
I have an function which returns a 1-D array with 2 rows called Y. I pass
this to a variable called X. I know what to use a Select Case structure to
test the values of the values in the array. Prior to the Select Case, I can
test the variable X and confirm there is data within it. However my Select
case fails with a "Run-Time Error "9" Subscript out of range" error. I have
also tried changing the Select Case to "Select Case X" But when I do this I
get a "Run-time error 13. Type Mismatch" error. What am I doing wrong?
'*****************************
Sub test()
Dim a as String
Dim b as String
Dim X As Variant
X = Y(a, b)
Select Case x()
Case x(0) > 0
More Code......
End Select
'****************************************
Private Function Y(aa As String, bb As String) As Variant
Dim a As Double
Dim b As Double
ReDim temparray(0 To 1)
a = Function1 which extracts numbers from string(aa,bb)
b = Function2 which extracts numbers from string(aa,bb)
temparray(0) = a
temparray(1) = b
Y = temparray
End Function
"**************************
Thanks
EM
this to a variable called X. I know what to use a Select Case structure to
test the values of the values in the array. Prior to the Select Case, I can
test the variable X and confirm there is data within it. However my Select
case fails with a "Run-Time Error "9" Subscript out of range" error. I have
also tried changing the Select Case to "Select Case X" But when I do this I
get a "Run-time error 13. Type Mismatch" error. What am I doing wrong?
'*****************************
Sub test()
Dim a as String
Dim b as String
Dim X As Variant
X = Y(a, b)
Select Case x()
Case x(0) > 0
More Code......
End Select
'****************************************
Private Function Y(aa As String, bb As String) As Variant
Dim a As Double
Dim b As Double
ReDim temparray(0 To 1)
a = Function1 which extracts numbers from string(aa,bb)
b = Function2 which extracts numbers from string(aa,bb)
temparray(0) = a
temparray(1) = b
Y = temparray
End Function
"**************************
Thanks
EM