News1 min ago
Excel conditional colouring of cells......
4 Answers
I have a cell containing a date, I would like to colour that cell based on the day of the week that the date represents so if it's a sunday it's blue etc etc. any idea how this miracle is to be achieved. Thanks
Answers
Best Answer
No best answer has yet been selected by R1Geezer. Once a best answer has been selected, it will be shown here.
For more on marking an answer as the "Best Answer", please visit our FAQ.Click on the format menu and select conditional formatting.
Problem is you can only have 3 conditional formatting rules per cell
http://www.contextures.com/xlcondFormat01.html
Problem is you can only have 3 conditional formatting rules per cell
http://www.contextures.com/xlcondFormat01.html
Not sure if you need this but I thought I'd post this macro for you just in case.
Dim rCell As Range
' Start Counter
For Each rCell In Range("A1:AT500")
' Check fot the correct criteria and chenge the colour appropriatly
' Do this for Red Monday, Amber Tuesday and Green Wednesday check on all cells in range
If UCase(rCell) = "Monday" Then
Range(rCell.Address).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ElseIf UCase(rCell) = "Tuesday" Then
Range(rCell.Address).Select
With Selection.Interior
.ColorIndex = 45
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ElseIf UCase(rCell) = "Wednesday" Then
Range(rCell.Address).Select
With Selection.Interior
.ColorIndex = 50
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Next rCell
End Sub
Dim rCell As Range
' Start Counter
For Each rCell In Range("A1:AT500")
' Check fot the correct criteria and chenge the colour appropriatly
' Do this for Red Monday, Amber Tuesday and Green Wednesday check on all cells in range
If UCase(rCell) = "Monday" Then
Range(rCell.Address).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ElseIf UCase(rCell) = "Tuesday" Then
Range(rCell.Address).Select
With Selection.Interior
.ColorIndex = 45
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ElseIf UCase(rCell) = "Wednesday" Then
Range(rCell.Address).Select
With Selection.Interior
.ColorIndex = 50
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Next rCell
End Sub
Related Questions
Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.