Find cells containing multiple values in random order

L

Lucas

Hello,

I'm using the find function to search for a single cell containing multiple
predefined words. For example all cells containing the letter A and B, using
the following code:

Set X = Selection.Find(what:="A" & "*" & "B")

But this search only finds cells that conatin A and B in that particular
order. Thus a cell containing BA is not found! Is there a way to adapt the
find statement in such a way the order of the words in a cell are no longer
dependent on the search result?

thanks in advance,

Lucas van Rijsewijk
Deurne, The Netherlands
 
G

Gary''s Student

Sub lucas()
Set X = Selection.Find(what:="A" & "*" & "B")
Set Y = Selection.Find(what:="B" & "*" & "A")
Set X = Union(X, Y)
End Sub
 

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