Dynamic setting of cell's color
How can I dynamically set cell's color in Excel?
It seems that color is not considered as a property with built-in functions to handle it.
Any advice?
Ben
Web Development
How can I dynamically set cell's color in Excel?
It seems that color is not considered as a property with built-in functions to handle it.
Any advice?
Ben
by mjrebholz
It depends what you mean by dynamically in this case, Ben. Typically, you might want the color of a cell or the font to change based on a set of criteria (for example, if cell A3 is greater than the value in B5, then show cell C5 in red.)
This iscalled conditional formatting. Go to the "format" menu, then "conditional formatting". You can then choose an 'argument' based on how you want the colour or appearance of cells or text to change under given circumstances. The "Border" tab under conditional formatting typically contains the features that will allow you to change the cell colour.
Regards
by benkindagozo
by wjhunt
Ben,
Here is some code that sets a cell's color:
Range("D5").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
You can wrap your conditionals around it...
by benkindagozo
by benkindagozo
This discussion is closed to new replies.
Sort by Trending