Wildcard use in comparason.. Please help

K

KJ MAN

Here's my code.

For Each c In myrange
If UCase(c.Value) = UCase(Artist) Then

I need the match to return * Artist *. I need to to be
an exact match, or a match with characters preceeding and/or following.
I tried
Ucase("*" & Artist & "*")
and also
Ucase(* & Artist & *)

Neither worked. Any suggestions?
 
D

Dave Peterson

maybe...

if ucase(c.value) like Ucase("*" & Artist & "*") then

Did you really want spaces surrounding the Artist?

if ucase(c.value) like Ucase("* " & Artist & " *") then
 
R

Rick Rothstein

Try it this way...

For Each c In myrange
If InStr(1, c.Value, "Artist", vbTextCompare) > 0 Then
 
Top