Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

Why do my wildcards in VBA not work

I have the below code , but it does not work.  As an example if AA2 has "501D" as the value and D2 has a value of JonesCo/////ty501D.00 no match is found even though the string in AA2 contains 501D ?  Any suggestions ?

IF .Range("AA" & intRow) Like "*" &  .Range("D" & intRow) & "*" THEN
msgBox "Partial Match Found"

ELSE

END IF
0
upobDaPlaya
Asked:
upobDaPlaya
2 Solutions
 
zorvek (Kevin Jones)ConsultantCommented:
It works for me.

Kevin
0
 
zorvek (Kevin Jones)ConsultantCommented:
Set a breakpoint and inspect intRow. Make sure it's 2.

Kevin
0
 
IrogSintaCommented:
Looks like you're doing it in reverse.  If D2 has the full text and AA2 has "501D" then you should be using:
IF .Range("D" & intRow) Like "*" & .Range("AA" & intRow) & "*" THEN

Open in new window

Ron
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
zorvek (Kevin Jones)ConsultantCommented:
I had my test data backwards too!

That's it.

Kevin
0
 
upobDaPlayaAuthor Commented:
Aaaarhhhg.. I was banging my head on this one.  Thanks !
0
 
rspahitzCommented:
sorry...wrong area
0
 
upobDaPlayaAuthor Commented:
Saved me a boatload of time...Thanks !
0
 
zorvek (Kevin Jones)ConsultantCommented:
I appreciate the points but Ron nailed it and I missed it. If I were grading he would get all the points.

My idea of setting breakpoints and inspecting variables is sound advice and, if that's why you gave me points, I can accept that.

Kevin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now