I have a custom fucntion which sums the values in a range depending on the background colour of the cell it works fine however it does not auto update when the colours change and the user has to manually recalculate the sheet by pressing f9 any ideas?
the code is below
Function SumColor(rColor As Range, rSumRange As Range)
'Written by Ozgrid Business Applications
'Application.Volatile True
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.Sum(rCell) + vResult
End If
Next rCell
SumColor = vResult
End Function
Thanks in Hope
JD
the code is below
Function SumColor(rColor As Range, rSumRange As Range)
'Written by Ozgrid Business Applications
'Application.Volatile True
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.Sum(rCell) + vResult
End If
Next rCell
SumColor = vResult
End Function
Thanks in Hope
JD