Find Text String
Hi Len, Sorry I didn't get back quicker. Try the code below. I think it
will do the trick.
Dim WB As Workbook, sh As Worksheet
Dim i As Integer
Set WB = ActiveWorkbook
Set sh = ActiveSheet
With WB
For i = 2 To sh.Range("C" & Rows.Count).End(xlUp).Row
If InStr(sh.Cells(i, 3), "HA") = 0 And _
InStr(sh.Cells(i, 3), "HVB") = 0 Then
MsgBox "Not Found"
Exit Sub
End If
Next i
End With
"Len" wrote in message
...
Hi All,
Thanks for your quick reply and your codes
Ozgrid, thanks for your reference of website
JL, yes! you are right and this is the codes that I'm looking for
However, after I work around based on the suggested codes provided by
JL, there is no response
Then I try to modify the codes as follows and it is not completely
worked, please help
Dim WB As Workbook, sh As Worksheet
Dim i As Integer
Set WB = Workbooks("ABC.xls")
Set sh = ActiveSheet
With WB
For i = 2 To sh.Range("C" & Rows.Count).End(xlUp).Row
If InStr(sh.Cells(i, 3), "HA") = 0 Then
x = x + 1
End If
If InStr(sh.Cells(i, 3), "HVB") = 0 Then
y = y + 1
End If
If x = 0 Then
MsgBox "HA Not Found"
Exit Sub
Else
x = 0
End If
If y = 0 Then
MsgBox "HVB Not Found"
Exit Sub
Else
y = 0
End If
Next i
End With
Thanks & Regards
Len
|