If you want to count the cells with a specific background color in a range like below
Here is the function
Function count_colored_values(x As Range, su As Range)
Dim Y As Range
Dim sm1 As Long
For Each Y In su
If Y.Interior.Color = x.Interior.Color Then
sm1 = sm1 + 1
count_colored_values = sm1
type like count_colored_values(f9,$A$2:$A$23)
"$A$2:$A$23" - is a range in which you have to count the cells .
"f9" - is a cell having background or fill color
the function will return the count of cells in a range passed who are having background color same as of "f9"
Monday, February 21, 2011
Function To count specific fill or background colored cells in a range
Subscribe to: Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
If you want to add a new menu on mouse right click "Workbook Navigation showing you the list of all open workbooks and worksheets in ea...
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
Post a Comment