Excel vba search in array -
i need search in array
sub f() dim myarray variant myarray = worksheets("qq").range("d:f") dim searchterm string searchterm = "927614*" 'check if value exists in array if ubound(filter(myarray, searchterm)) >= 0 , searchterm <> "" msgbox "your string match value f column " & myarray(application.match(searchterm, myarray, false),3) else msgbox ("search term not located in array") end if end sub
but error type mismatch. how lookup value * in array?
just loop through array , use like
.
untested code:
dim matchfound boolean matchfound = false = 1 ubound(myarray, 1) j = 1 ubound(myarray, 2) if myarray(i, j) searchterm msgbox "found match @ (" & & "," & j & ") : " & myarray(i, j) matchfound = true exit end if next j if matchfound exit next if not matchfound msgbox "no match found."
Comments
Post a Comment