I have created a simple excel formula to know what is the color of the font of the cell A1
Function GetFontColorIndex(elrango As Range) As Integer
Application.Volatile
GetFontColorIndex = elrango.Cells(1, 1).Font.ColorIndex
End Function
In excel-2010:
File > Options > Formulas > Workbook Calculation > Automatic is checked
In cell A1
I have a number, and in cell A3
I have=GetFontColorIndex(A1)
but when I change the font of cell A1
, the formula does not update automatically on cell A3
. I have to click shift+F9
and then it works.
Any idea why is not showing the number of the font automatically?
A Volatile Function in a formula in a cell makes that cell be always recalculated at each recalculation
. Changing formatting (font color) doesn't triggers recalculation. what you can do is addWorksheet_SelectionChange
event withActiveSheet.Calculate
. In many cases it would solve your problem – Dmitry Pavliv