Below is the macro if you want to
- search for multiple strings within an excel cell
- check if a cell contains multiple text strings
- check if a cell contains one or more sub-strings
I used four strings to search for in below macro, you can increase or decrease the count based on your requirement.
VBA Macro to search for multiple strings within a cell
Sub checkMultipleStringsInCell() ' Suppose subStr1,subStr2,subStr3 and subStr4 are the strings that you want check in a excel cell ' Below condition checks whether the excel cell has all above strings ' If the cell contains them, it prints "Found the cell" If InStr(ActiveCell.Value, subStr1) > 0 And InStr(ActiveCell.Value, subStr2) > 0 And _ InStr(ActiveCell.Value, subStr3) > 0 And InStr(ActiveCell.Value, subStr4) > 0 Then MsgBox ("Found the cell") Else MsgBox ("Not found") End If End Sub