View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Macro: Finding Text Within Text

maybe something simple like this:

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

With ws
If InStr(.Range("A1"), "AUA") Then
MsgBox "found"
End If
End With

End Sub

--


Gary

"Simon" wrote in message
...
I need to determine whether a cell contains a particular string of text,
what
is the best function or way of doing this in my macro?

For Example:
I want to know whether cell A1 contains the text "AUA", if it does then
I'm
going to execute some code, if it doesn't then I'm going to execute some
other code. I was trying to use the Range.Find method but I had a lot of
trouble with it.

Thanks.