Thread: Search
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Search

Hi,
Try this :

Sub test()

Dim stringtosearch As String
Dim stringtofind As String

stringtosearch = "ABCDEFG"
stringtofind = "C"

If InStr(1, stringtosearch, stringtofind) < 0 Then
MsgBox "C found" ' Add found logic.....
Else
MsgBox "C not found" ' Add not found logic ....
End
End If

End Sub

HTH

"tjh" wrote:

Hello,

I am stuck and cannot remember how to do this...

I would like to perform an if statement that:

if (the current cell has a "C" character somewhere within it) then
.......Perform an action......
elseif (it does not) then
.........perform another action.......
endif

What statement do I need to use to determine if a "C" is a character
anywhere in the cell. I remember how to use the Left, Right and Mid
functions, but I cannot remember how to use the Search function in this
manner. What would be the best way to go about doing this?

Thank You,