B Bob Phillips Jul 4, 2004 #2 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)
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 Jul 4, 2004 #3 Are you looking for the largest index for that array? msgbox ubound(myVar)
R Rob van Gelder Jul 5, 2004 #4 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
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