Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing the color of a cell acording to its value
Hi.. I wanna a macro that can change the color of a cell acording to its
value. I've tried conditional formating, but it doesnt work cause I have 5 ranges of values. from 0% to 79% = black with white font from 80% to 84% = red with white font from 85% to 87% = white with red font. from 88% to 92% = yellow with red font from 92% to 100% = green with white font Could you helpme?? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing the color of a cell acording to its value
This will apply formatting to every cell in your current selection (I.e., if
you select range A1:D4, formatting will be applied to those 16 cells) Sub CellColor() for each cell in selection If Cell.Value = 0 And Cell.Value <= 0.79 Then 'Black with white Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 1 End If If Cell.Value 0.79 And Cell.Value <= 0.84 Then 'Red with white Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 3 End If If Cell.Value 0.84 And Cell.Value <= 0.87 Then 'White with red Selection.Font.ColorIndex = 3 Selection.Interior.ColorIndex = 2 End If If Cell.Value 0.87 And Cell.Value <= 0.92 Then 'Yellow with red Selection.Font.ColorIndex = 3 Selection.Interior.ColorIndex = 6 End If If Cell.Value 0.92 And Cell.Value <= 1 Then 'Green with white Selection.Font.ColorIndex = 2 Selection.Interior.ColorIndex = 10 End If next cell End Sub -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Dani Lima" wrote: Hi.. I wanna a macro that can change the color of a cell acording to its value. I've tried conditional formating, but it doesnt work cause I have 5 ranges of values. from 0% to 79% = black with white font from 80% to 84% = red with white font from 85% to 87% = white with red font. from 88% to 92% = yellow with red font from 92% to 100% = green with white font Could you helpme?? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing the color of a cell acording to its value
Conditional formatting works for me in 2007.
-- Roland "Dani Lima" wrote: Hi.. I wanna a macro that can change the color of a cell acording to its value. I've tried conditional formating, but it doesnt work cause I have 5 ranges of values. from 0% to 79% = black with white font from 80% to 84% = red with white font from 85% to 87% = white with red font. from 88% to 92% = yellow with red font from 92% to 100% = green with white font Could you helpme?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing the color of a cell based on the color of another cell. | Excel Discussion (Misc queries) | |||
Chaging the color of a cell acording to its value | Excel Programming | |||
Changing cell color by value | Excel Worksheet Functions | |||
I WANT DATA TO LINK WITH OTHER WORKBOOKS ACORDING TO CELL CONTENT. | Excel Worksheet Functions | |||
Changing cell color | Excel Programming |