Change the font color of a cell if other cells are not empty
Matthew Barrera
How can I write the following code expression in Excel? What I want is to be able to change the font color of a cell if other cells are not empty.
Expression:
if cell A1, A2 & A3 are not empty change the font color of Cell B1
I tried...
=IF(A1:A3 <> "", B1.Font.Color = vbRed)...but it doesn't work, all I see is #NAME?
Again, what I want is to change the font color of a cell based on the state of other cells.
31 Answer
B2.Font.Color = vbRed is not a value the cell can return, it is VBA code that can't be used in a formula.
In this case, you will want to use conditional formatting.