Hi all,
I'm refining the code on a macro I posted a couple of weeks ago, and one of the issues I'm encountering is how to have my macro highlight a row in red for the text phrase "Winery Direct", when the cell contains more than just these two words. Unfortunately, I'm at the mercy of the sales team who sends me the data file, so sometimes they will send the file and the columns containing only text, but at other times they'll send it with text and dates mixed in this column. The purpose for highlighting this row is so that I can capture it and delete it before importing into my financial software since a Winery Direct has already been created and so this line would create a duplicate record. Make sense?
I know that when the cell contains only "Winery Direct", the highlighting works, but when it contains mixed data, it doesn't so I'm certain I need to add something like a string for contains, but I'm not advanced enough in VBA to know how to code for that. Any advice or pointers is most welcome.
'search column "n", winery direct=red
Sheets(2).Activate
With Sheets(2)
vDataFour = .Range("n1:n" & .Range("n65536").End(xlUp).Row)
End With
For m = 1 To UBound(vDataFour, 1)
itype = vDataFour(m, 1)
If itype = "WINERY DIRECT" Then
Rows(m).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End If
Next m
Display More