Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This function is taken from C Pearsons site and it counts the number of cells
within a range. Can someone explain the asterixxed lines below Thanks #CountByColor = CountByColor - _ # (Rng.Font.ColorIndex = WhatColorIndex) #Else # CountByColor = CountByColor - _ # (Rng.Interior.ColorIndex = WhatColorIndex) Function CountByColor(InRange As Range, _ WhatColorIndex As Integer, _ Optional OfText As Boolean = False) As Long ' ' This function return the number of cells in InRange with ' a background color, or if OfText is True a font color, ' equal to WhatColorIndex. ' Dim Rng As Range Application.Volatile True For Each Rng In InRange.Cells If OfText = True Then CountByColor = CountByColor - _ (Rng.Font.ColorIndex = WhatColorIndex) Else CountByColor = CountByColor - _ (Rng.Interior.ColorIndex = WhatColorIndex) End If Next Rng End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
counting the occurrence of specific text within a date range | Excel Worksheet Functions | |||
Counting items with a specific quanitifier in a date range | Excel Worksheet Functions | |||
Counting Specific Character(s) In A Range? | Excel Discussion (Misc queries) | |||
Counting a specific range of values within a column | Excel Discussion (Misc queries) | |||
counting cells in a data range that meet 3 specific conditions | Excel Discussion (Misc queries) |