View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default ParamArray debug anomaly

The array is x(0) not x(0)(1)

Sub abtest5()
Dim x, y
x = Range("a51:d54")
y = foo10(x)
End Sub

Function foo10(ParamArray x())
Dim z
z = UBound(x(0))
End Function


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alan Beban" wrote in message
...
I have the following, with the first row of the range containing the values
33,34,35,36. When I run the sub procedure the Locals window shows in part
as below, indicating that x(0)(1) is a Variant array, but I get a
"Subscript out of range" error message at the line of foo10,
z = UBound(x(0)(1). Can someone explain the apparent anomaly?

Thanks,
Alan Beban

Sub abtest5()
x = range("a51:d54")
y = foo10(x)
End Sub

Function foo10(ParamArray x())
z = UBound(x(0)(1))
End Function

x Variant(0 to 0)
x(0) Variant/Variant/Variant(1 to 4,1 to 4)
x(0)(1) Variant(1 to 4)
x(0)(1,1) 33 Variant/Double
x(0)(1,2) 34 Variant/Double
x(0)(1,3) 35 Variant/Double
x(0)(1,4) 36 Variant/Double