returning number of subscripts? MyVar(x)

B

Bob Phillips

Jason,

The question is unclear. x is a variable in this case, which must have been
set within the code and you can query it

MsgBox x

Debug.Print x

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
D

Dave Peterson

Are you looking for the largest index for that array?
msgbox ubound(myVar)
 
R

Rob van Gelder

Are you trying to get the index in an array?

Example:


Sub test()
Dim arr() As Long, i As Long, blnFound As Boolean, lngFind As Long

ReDim arr(1 To 100)
For i = 1 To 100
arr(i) = i * 5
Next


'' find

lngFind = 50
blnFound = False
For i = LBound(arr) To UBound(arr)
If arr(i) = lngFind Then
blnFound = True
Exit For
End If
Next

If blnFound Then
MsgBox i
End If

End Sub
 
Top