find multiple or by different words

L

Lucas

Hello,

I would like to us the find function on a sheet to search for either of 2
words.
If I want to search for multiple words for example A and B I use:

..Find(what:="A" & "*" & "B",

But what do I use if i want to search for A OR B.
I know I can first search for A and subsequently for B but I would like to
use a single find function.

thanks in advance!
Lucas van Rijsewijk
Deurne, The Netherlands
 
P

Per Jessen

Hello Lucas

I don't think you can search for two strings at once.

Maybe this will help you.

Set found = Columns("A").Find(what:="A")
If found Is Nothing Then
Set found = Columns("A").Find(what:="B")
End If

Regards,
Per
Copenhagen, Denmark
 
L

Lucas

Thanks for your reply Per!
Using the Set function also avoids an error message if nothing is found.

Thanks for helping out this newbie!
 

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

Top