Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's a macro that can be easily extended should you need more than 3
colours Sub colours() Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = 1 To iLastRow With Cells(i, "A") Select Case .Value Case "*": .Interior.ColorIndex = 3 'red Case "**": .Interior.ColorIndex = 5 'blue Case "***": .Interior.ColorIndex = 10 'green End Select End With Next i End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Dave Peterson" wrote in message ... As long as you don't exceed three possibilities, you could use a non-macro approach. You could use Format|Conditinal formatting... Give it three conditions: Cell value is ="*" and a nice format click Add cell value is ="**" and another nice format click add cell value is = "***" and a last nice format (Conditional formatting only supports 3 conditions, though.) "nebb <" wrote: My Excel worksheet has numerous cells that contain the same type formula resulting in placing either *, or **, or *** in each of these cells. The data on the sheet is changed each week such that any cell, in any particular week, might contain any of the three possibilities. I would like to be able to run a macro that would insert one background color in each cell that contains one *, another color in those cells that contain **, and still another background color in those cells that contain ***. Any help would be greatly appreciated. --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cell Background Color | Excel Worksheet Functions | |||
cell background color and cell text color | Excel Worksheet Functions | |||
Add background color to cell | Excel Discussion (Misc queries) | |||
Default Border, Font Color, and Cell Background Color | Excel Discussion (Misc queries) | |||
Set background color of a cell in VBA | Excel Programming |