Problem with using the "Like"-Operator.

  • Thread starter Thread starter Joepy
  • Start date Start date
J

Joepy

Hi, I have just encountered a very strange problem when comparing
strings:

Here is an example:

If "10" Like "[7,8,9,10,11]" Then
MsgBox "Found!"
Else
MsgBox "Not found!"
End If

The result is "Not found", although it should find the 10 inside the
other string. The strange thing is it finds 7,8 and 9, but not the
two-digit numbers.

How can I get this to work?
Any help is appreciated.
Regards,
Markus
 
Markus,
the order of the operands is important. Also you need the
wildcards:

If "[7,8,9,10,11]" Like "*10*" Then
MsgBox "Found!"
Else
MsgBox "Not found!"
End If

HTH
Kostis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top