LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default Conditional Formatting - Applying Format Based Custom Functions

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ignore auto format after applying a custom format?? jigglepop Excel Discussion (Misc queries) 0 April 2nd 08 04:17 PM
Applying Conditional Formatting to Multiple Worksheets - Excel 200 David Excel Discussion (Misc queries) 0 September 22nd 07 05:50 PM
Applying Conditional Formatting to Muliple Worksheets in Excel 200 David Excel Discussion (Misc queries) 0 September 16th 07 11:10 PM
Applying conditional formatting to a workbook in excel 2003 kuroitenpi Excel Discussion (Misc queries) 1 November 29th 06 07:05 PM
Applying conditional formatting to cell based on another cell's in kdesemple Excel Discussion (Misc queries) 1 March 22nd 06 06:37 PM


All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"