LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting with conditions based on another range stephanie Excel Worksheet Functions 5 November 30th 09 09:19 AM
shade cells based on conditions - i have more than 3 conditions Mo2 Excel Worksheet Functions 3 March 30th 07 07:19 AM
Highlighting Range of Cells based on another cell with 5 condition Alex Excel Programming 6 November 10th 06 06:45 AM
Add cells from a range based on 2 conditions from 2 other ranges Kelly Excel Worksheet Functions 3 July 7th 05 07:40 PM
Macro to input formula in range based on another range Peter Atherton Excel Programming 0 October 9th 03 12:47 AM


All times are GMT +1. The time now is 07:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"