find multiple or by different words

  • Thread starter Thread starter Lucas
  • Start date Start date
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
 
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
 
Thanks for your reply Per!
Using the Set function also avoids an error message if nothing is found.

Thanks for helping out this newbie!
 
Back
Top