Skip to main content
Support is Offline
Today is our off day. We are taking some rest and will come back stronger tomorrow
Official support hours
Monday To Friday
From 09:00 To 17:30
  Thursday, 07 June 2018
  0 Replies
  2K Visits
0
Votes
Undo
I have used you very useful Module for counting the number of color filled cells, which works very well.
However, I want to color the cells by Conditionally formating them, and the VBA module does not work in that case.
The spreadsheet I am working on analyses the spend for a commodity per month. The cell is linked to another sheet to show the value for the month.
I guess that you may be able to alter the VBA module, but I am not very conversant with VBA.
Can anyone help to alter the script to accomodate my needs?
Here is the VBA code:
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
There are no replies made for this post yet.