Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search
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, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Two search category & two search terms | Excel Discussion (Misc queries) | |||
file search or search files | Excel Discussion (Misc queries) | |||
Functions (search within search result) reply to this please | Excel Worksheet Functions | |||
How do I search excel spreadsheets using multiple search criteria. | Excel Worksheet Functions | |||
Create a search Field within a worksheet to search command buttons | Excel Programming |