Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
A custom function to sum/count cells of a defined color like the following
works well with normal cells but not with a conditional formatted one. How 2 overcome this problem? Function SumColor(rSumRange As Range, rColor As Range) 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 Function CountColor(rSumRange As Range, rColor As Range) 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 = vResult + 1 End If Next rCell CountColor = vResult End Function -- Best Regards, FARAZ A. QURESHI |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ignore auto format after applying a custom format?? | Excel Discussion (Misc queries) | |||
Applying Conditional Formatting to Multiple Worksheets - Excel 200 | Excel Discussion (Misc queries) | |||
Applying Conditional Formatting to Muliple Worksheets in Excel 200 | Excel Discussion (Misc queries) | |||
Applying conditional formatting to a workbook in excel 2003 | Excel Discussion (Misc queries) | |||
Applying conditional formatting to cell based on another cell's in | Excel Discussion (Misc queries) |