I have the following code and I am trying to check the cells in the range for a specific word. The word in this case is Test. It can come up in all sorts of ways, ex: Test program/ Program Test/programTest etc.
How do I make the LIKE operator work in my case? I can't seem to make it work in this case *Test or with any other operators.
What am I missing?
Sub Macro1()
Dim lastrow As LongPtr
Dim TagSheet As Worksheet
Dim LDRange As Range
Set TagSheet = Worksheets("sheet1")
TagSheet.Activate
lastrow = TagSheet.Range("AO" & Rows.Count).End(xlUp).row
Sheets("sheet1").Activate
ActiveSheet.Cells(lastrow, 41).Select
Range(Selection, Selection.End(xlUp)).Select
Set LDRange = Selection
LDRange.Select
For Each Cell In LDRange
If Cell Like "*test" Then
MsgBox "yes"
Else
MsgBox "no"
End If
Next