returning number of subscripts? MyVar(x)

  • Thread starter Thread starter Jason
  • Start date Start date
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)
 
Are you looking for the largest index for that array?
msgbox ubound(myVar)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top