Forum Discussion
How to count by FONT COLOR in excel when font color depends on a conditional formatting rule?
hi dear! thanks for taking time to help.
I am a little bit lost. Please enlighten me.
(1) the first set of codes, this is VB code and will be placed in module 1, right?
(2) the 2nd set of codes, where will I insert this?
I tried putting both sets of codes in the VB-module. However, I cant figure out the formula that has to be entered in excel.
I tried this...
more functions > user defined category > getCountBasedOnCFFontColor
the formula i used...
=getCountBasedOnCFFontColor(B17:B1016,B17)
B17:B1016 is the range
the last B17 is the first cell of my data in RED FONT COLOR (i doubted this)
thank you very much again! looking forward to hear an update!
No, that function was not supposed to be used on the Worksheet like a regular function.
- AllanDBacon51Aug 27, 2022Copper Contributor
Would you clarify this statement more clearly as I am not very familiar with VB and am trying to do something similar.
Thanks!
- HansVogelaarAug 27, 2022MVP
The function getCountBasedOnCFFontColor posted by Subodh_Tiwari_sktneer can't be used in a formula in a cell. This is because it refers to the DisplayFormat property of a range; this property doesn't work if used in a cell formula.
The function can only be used in other VBA code, such as the macro CountCellsWithRedFont in the same post.