I want to shade columns A through H for any row (after row 4) whose value in column A begins with 'A_', 'T_', or 'L_'. I execute the following block in my Autpen macro but the result is that any row that does not contain any text in column A gets highlighted instead. Can anyone help me figure out what I'm doing wrong? I'd really appreciate it!
Dim valstart As String
Dim O As Long
Dim lastrow
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For O = 4 To lastrow
Dim valstart As String
Dim O As Long
Dim lastrow
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For O = 4 To lastrow
valstart = Left(Cells(O, "A").Value, 2)
If (valstart = A_) Or (valstart = T_) Or (valstart = L_) then
Next OIf (valstart = A_) Or (valstart = T_) Or (valstart = L_) then
Range(Cells(O, 1), Cells(O, 8)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End IfWith Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With