Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook that consists of monthly calenders that uses single text
characters in cells that I want to automatically convert to a specific colour when entered in a range in each worksheet. I am familiar with conditional formatting but have more than three different formats. I need some basic vba code to colour the cells that match the following entire cell contents: Dog Purple Cat Blue M Red O Yellow V Green |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Let's say the cells are in column A. Try the following worksheet event macro:
Private Sub Worksheet_Change(ByVal Target As Range) Set r = Range("A:A") If Intersect(Target, r) Is Nothing Then Exit Sub With Target Select Case .Value Case "Dog" .Interior.ColorIndex = 39 Case "Cat" .Interior.ColorIndex = 5 Case "M" .Interior.ColorIndex = 3 Case "O" .Interior.ColorIndex = 6 Case "V" .Interior.ColorIndex = 10 End Select End With End Sub -- Gary''s Student - gsnu200752 "Tony" wrote: I have a workbook that consists of monthly calenders that uses single text characters in cells that I want to automatically convert to a specific colour when entered in a range in each worksheet. I am familiar with conditional formatting but have more than three different formats. I need some basic vba code to colour the cells that match the following entire cell contents: Dog Purple Cat Blue M Red O Yellow V Green |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Code; need linked cells to change color if condition met | Excel Worksheet Functions | |||
Condition Formatting - Work Sheet Event Code | Excel Programming | |||
Condition Formatting in code. How? | Excel Programming | |||
Condition Formatting in code. How? | Excel Programming | |||
Condition Formatting in code. How? | Excel Programming |