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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array functions

Status
Not open for further replies.

djam

Technical User
Joined
Nov 15, 2002
Messages
223
Location
CA
where would I find all the functions related to an array, i looked in the help, but there must be more then that? I'm looking for a function that checks if an array contains a specific element.

Maybe there isn't such a function and I have to write my own?
"so many events, so little time"
 
Here's the general idea. Tweak it to suit your needs.

Private Sub searcharray()
Code:
Dim myarray(3) As Variant
Dim i As Integer
myarray(0) = "Dog"
myarray(1) = "Cat"
myarray(2) = "Mouse"
For i = 0 To UBound(myarray) - 1
    If myarray(i) = "Mouse" Then
        Debug.Print myarray(i) & " " & i
    Else
        End If
Next i
End Sub
Tyrone Lumley
augerinn@gte.net
 
There is no function in VB or VBA to find an element with a specified value. I know it doesn't help now but VB.Net does have it with IndexOf. Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top