Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array

Status
Not open for further replies.

EscapeUK

Programmer
Jul 7, 2000
438
GB
How do I go through an array checking the values to see if any match a value I have stored in a variable. or until i reach the end of it.

ta

 
Try something along these lines:

For i = LBound(ArrayName, 1) To UBound(ArrayName, 1)
If Val(ArrayName(i, 1)) = WhatYouAreSearchingFor Then
DoSomethingCool
Endif
Next
 
There's a function UBound() that takes the array as an argument and returns the highest index in that array. You can use that to determine how many times to loop and conpare
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top