Search for string containing
Here's part of code that I'd probably set up to do it:
Dim testRange as Range
Dim anyTestCell as Range
Set testRange = ActiveSheet.Range("K1:" & _
ActiveSheet.Range("K" & Rows.Count).End(xlup).Address)
For Each anyTestCell in testRange
If Instr(anyTestCell,"RG")0 Then
Range("Q" & anyTestCell.Row) = "TRC"
End IF
Next ' end anyTestCell loop
.... more code
'good housekeeping:
Set testRange = Nothing
....
End Sub
"richzip" wrote:
Hello,
I have the following in VBA:
If .Cells(X, "K") = "RG" Then
.Cells(X, "Q").Value = "TRC"
How can I modify this formula to look in column K for a string that contains
RG and perform the same function? (i.e., if it contains RG-TRVL or TRVL-RG,
then TRC should automatically be placed in column Q)?
Thank you.
|