Hi VBA community!

In the worksheet I have a UDF that counts the number of cells in the range that are filled with different color backgrounds. Each time when I added or removed some background colors, I used the following recalculation code to recalculate the formula but it didn't work (unless press F2 and Enter).

Appreciate any help on this with a code that can allow the UDF to recalculate. I'm using Excel 2003. Many thanks

    Application.Volatile
    Application.Calculate
    ActiveWorkbook.RefreshAll