Forum Discussion
Tommee
May 02, 2023Copper Contributor
Change the cell's font color in a cell based on other cell's values not using conditional formatting
Hello. Can somebody help me code in each cell how to change the font color based upon another cell's value? I know how to do it in excel VBA using vbBlack and vbWhite or RGB(0,0,0) and RGB(255,255,25...
HansVogelaar
May 02, 2023MVP
There are three ways you can make the font color of a cell change automatically:
- For numbers only, you can specify up to two different colors for ranges of values of the cell itself. For example, the custom number format [Green][<1000]0;[Red][>5000]0;0 will display numbers <1000 in green, numbers >5000 in red, and numbers in between in the standard color. A number format cannot be based on the value of another cell.
- Using conditional formatting.
- Using a VBA event procedure in the worksheet module (or in the workbook module).
A formula in a cell cannot directly change the cell's font color based on the value of another cell. (If somebody can prove me wrong, I'd be delighted...)
- TommeeMay 03, 2023Copper ContributorI created a VBA macro just in case another solution isn't available.
- huhsoundeffectMay 16, 2023Copper Contributorhey , could you share the vba macro?
- TommeeMay 03, 2023Copper Contributor
HansVogelaar Thank you for your advice.