Colors on a WorkSheet!!!

  • Thread starter Thread starter Gene
  • Start date Start date
G

Gene

I have a schedule at work and there are four crews, A,B,C,D. Each crew on
the schedule is a different color. I was wondering if there is a way or a
macro that will put a certain color in a cell with a certain letter?.. For
example, all the A's are Red, all the B's are Blue, All the C's are Green,
and all the D's are Yellow. Thanks Gene
 
Gene

Have a look at Conditional Formatting on the Edit menu, and Help on that
subject. That should do it for you.

HTH

Mike
 
Gene, Conditional Formatting has a limit of 3, here is a marco that will do
it, change the range to your range

To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Select Case Target
Case "A"
icolor = 3
Case "B"
icolor = 5
Case "C"
icolor = 10
Case "D"
icolor = 6
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub


--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
Using Format > Conditional Formatting will allow you to colour up to 3 values leaving black on white for the 4th.
 
Back
Top