Web design
Closed
renea
-
25 May 2010 à 10:44
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 25 May 2010 à 16:12
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 25 May 2010 à 16:12
Related:
- Web design
- 3d home design software - Guide
- Blackmagic design disk speed test windows - Download - Diagnosis and monitoring
- Design poster online free - Guide
- Iphone 14 design - Home - IOS
- How do i update my facebook account to new version and design - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
25 May 2010 à 16:02
25 May 2010 à 16:02
1 Press ALT + F11 to start VBE
2 Click on Insert to add a module
3 Paste the code (after instructions)
4 Call the function as
a. To Find count of all cells in range ,F1:F6 with red color
=CountOnColor(255,False,F1:F6)
a. To Find count of all cells in range ,F1:F6 with red color and with data
=CountOnColor(255,true,F1:F6)
C. To Find count of all cells in range ,F1:F6 with red color and no data
=CountOnColor(255,false,F1:F6) - CountOnColor(255,true,F1:F6)
2 Click on Insert to add a module
3 Paste the code (after instructions)
4 Call the function as
a. To Find count of all cells in range ,F1:F6 with red color
=CountOnColor(255,False,F1:F6)
a. To Find count of all cells in range ,F1:F6 with red color and with data
=CountOnColor(255,true,F1:F6)
C. To Find count of all cells in range ,F1:F6 with red color and no data
=CountOnColor(255,false,F1:F6) - CountOnColor(255,true,F1:F6)
Function CountOnColor(backGroundColorRGB As Long, CountOnlyNonBlank As Boolean, ParamArray OtherArgs()) As Variant
Dim Count As Double
Dim temp As Variant
Dim Cell As Range
Application.Volatile
On Error GoTo 0
Count = 0
If (UBound(OtherArgs) < 0) Then
MsgBox "Not Sufficient parameters Passed"
CountOnColor = "** ERROR **"
Exit Function
End If
For Each items In OtherArgs
temp = 0
Select Case LCase(TypeName(items))
Case Is = "range"
For Each Cell In items
If Cell.Interior.Color = backGroundColorRGB Then
temp = temp + 1
If ((CountOnlyNonBlank) And (Cell = "")) Then temp = temp - 1
End If
Next Cell
Case Else
GoTo NON_CELL_ERROR
End Select
Count = Count + temp
Next items
CountOnColor = Count
Exit Function
NON_CELL_ERROR:
MsgBox ("Non Cell/Range parameter encountered")
CountOnColor = "** ERROR **"
Exit Function
End Function
25 May 2010 à 16:05
I have been observing you with Excel messages. You work wonders don't you!
Thank you
25 May 2010 à 16:12