Trebor8484
Board Regular
- Joined
- Oct 27, 2018
- Messages
- 69
- Office Version
- 2013
- Platform
- Windows
Hi, Can anyone assist with this please.
I am trying to test cells for the below conditions, but I need to find instances where the word VBA or TEST appears in a cell rather than just the string itself, so for example the word TESTING currently shows.
Not sure if I need to use find rather than instr.
I am trying to test cells for the below conditions, but I need to find instances where the word VBA or TEST appears in a cell rather than just the string itself, so for example the word TESTING currently shows.
Not sure if I need to use find rather than instr.
VBA Code:
For Each c In SrcSheet.Range("H2:H" & SrcSheet.Cells(Rows.count, "A").End(xlUp).Row)
If InStr(1, c.Value, "LESSON", vbTextCompare) > 0 Then
If InStr(1, c.Value, "VBA", vbTextCompare) > 0 And InStr(1, c.Value, "TEST", vbTextCompare) > 0 Then
'Debug.Print c.Value
If rng Is Nothing Then
Set rng = c
Else
Set rng = Union(rng, c)
End If
End If
End If
Next c
Thanks