SUMFORMAT

There are 4 functions


SUMFORMAT

Returns the sum of all the values that have been formatted with multiple attributes.



SUMFORMAT_CELLCOLOR

Returns the total value of the numbers that have been formatted with the same colour.

'rgeSearchCells - The range of cells you want to check
'rgeCriteriaCell - The cell with the colour to check

Public Function SUMBYCELLCOLOR(ByVal rgeSearchCells As Range, _
                              ByVal rgeCriteriaCell as Range) as Double
Dim rgeCell As Range
For Each rgeCell In rgeSearchCells
   If rgeCell.Interior.Color = rgeCriteriaCell.Interior.Color Then
      SUMBYCELLCOLOR = SUMBYCELLCOLOR + rgeCell.Value
   End If
Next rgeCell
End Function


SUMFORMAT_FONTBOLD

Returns the sum of all the values that have been formatted in bold.


SUMFORMAT_FONTCOLOR

Returns the total value of the numbers that have been formatted with the same font colour

'rgeSearchCells - The range of cells you want to check
'rgeCriteriaCell - The cell with the colour to check

Public Function SUMBYFONTCOLOR(ByVal rgeSearchCells As Range, _
                              ByVal rgeCriteriaCell as Range) as Double
Dim rgeCell As Range
For Each rgeCell In rgeSearchCells
   If rgeCell.Font.Color = rgeCriteriaCell.Font.Color Then
      SUMBYFONTCOLOR = SUMBYFONTCOLOR + rgeCell.Value
   End If
Next rgeCell
End Function



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext