Highlighting a range using a Macro based on more then 5 conditions
Based upon your previous post I guess that you want something like this
Sub Test()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "P").End(xlUp).Row
For i = 1 To iLastRow
With Cells(i, "P")
Select Case .Value
Case "GI": Cells(i, "A").Resize(, 12) _
.Interior.ColorIndex = 46 'orange
Case "CA": Cells(i, "A").Resize(, 12) _
.Interior.ColorIndex = 6 'yellow
'etc.
End Select
End With
Next i
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Alex" wrote in message
...
Hi, I'm pretty new with VBA. I'm trying to highlight a range of cells for
example (A10:N500) based on cells located in column P. If P10=CA Then
A10:N10 will be highlighted yellow Else If P11=GI Then A11:N11 will be
highlighted orange and about three more coniditons. I would appreciate a
code for this.
-Thank you
|