View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sandy Sandy is offline
external usenet poster
 
Posts: 355
Default conditional formatting color

Using Excel 2003, I have downloaded John Walkenbach's calender

http://spreadsheetpage.com/index.php...with_holidays/

and added at the bottom columns for date A55:A88 and N55:N88 and columns for
code with a drop down list with 8 different entries B55:B88 and N55:N88. I
would like to conditional format the corresponding date on the calendar with
the matching color for the code column. Based on his formula for the
holidays =NOT(ISNA(MATCH(G7,holidays,0))) (which was formatted in each cell),
how would you put in a range for 7 different codes, as holiday is already
formatted? I have created a name for the date ranges as summary.

I assume VB is needed and I had the following based on community input that
I found:

Summary Formula Is = NOT(ISNA(MATCH(A17:Y49,summary,0))) '

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(A17:Y49)) Is Nothing Then
With Target
Select Case .Value
Case "A": .Interior.ColorIndex = 3 'red
Case "AD": .Interior.ColorIndex = 5 'blue
Case "D": .Interior.ColorIndex = 39 'purple
Case "L": .Interior.ColorIndex = 46 'orange
Case "O": .Interior.ColorIndex = 15 'grey
Case "P": .Interior.ColorIndex = 27 'yellow
Case "T": .Interior.ColorIndex = 43 'light green
Case "V": .Interior.ColorIndex = 22 'pink

End Select
End With
End If


ws_exit:
Application.EnableEvents = True
End Sub


A17:Y49 it the range of the calendar. I am new to VB. Any help would be
appreciated. Thanks in advance.