ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wildcard use in comparason.. Please help (https://www.excelbanter.com/excel-programming/417398-wildcard-use-comparason-please-help.html)

KJ MAN[_2_]

Wildcard use in comparason.. Please help
 
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?



Dave Peterson

Wildcard use in comparason.. Please help
 
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



KJ MAN wrote:

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?


--

Dave Peterson

Rick Rothstein

Wildcard use in comparason.. Please help
 
Try it this way...

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

--
Rick (MVP - Excel)


"KJ MAN" wrote in message
...
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?





All times are GMT +1. The time now is 10:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com