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

find in array 1

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
434
IT
based this old code i need to find in array from a part of element array...

but difficult to arrange, other way is welcomed!


Option Explicit
Dim MIO_Array() As Variant
Dim ELEMENTO As String
Sub FIND_IN_ARRAY()

MIO_Array = Array("Paolo", "Giovanni", "Sal")

ELEMENTO = "Sal"

If InStr(Join(MIO_Array), ELEMENTO) > 0 Then
Stop
End If

End Sub

in my case ELEMENTO is Sa, or i can have ELEMENTO is Giov

i need to retrieve Giovanni, based Giov... eccc
 

Code:
Option Explicit
Dim MIO_Array() As Variant
Dim ELEMENTO As String

Sub FIND_IN_ARRAY()[blue]
Dim i As Integer[/blue]

MIO_Array = Array("Paolo", "Giovanni", "Sal")

ELEMENTO = "Sal"
[blue]
For i = LBound(MIO_Array) To UBound(MIO_Array)[/blue]
    If InStr([blue]MIO_Array(i)[/blue], ELEMENTO) > 0 Then
        MsgBox ELEMENTO & " is in the element " & i & " - " & MIO_Array(i)
    End If[blue]
Next i[/blue]

End Sub

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top