SUMVISIBLE

Returns the total value of the numbers in cells that are visible


Remarks

* This function excludes hidden cells.
* You can use the SUM function to include hidden cells.
* For instructions on how to add a function to a workbook refer to the page under Inserting Functions
* The equivalent JavaScript function is SUMVISIBLE
* also ' =AGGREGATE(9,5,B3:B12)


Public Function SUMVISIBLE(ByVal rgeValues As Range) As Double 

Dim dbtotalvalue As Double
Dim rgeCell As Range

   Application.Volatile
   
   dbtotalvalue = 0

   For Each rgeCell In rgeValues
      If (rgeCell.EntireRow.Hidden = False) And _
         (rgeCell.EntireColumn.Hidden = False) Then
         
         dbtotalvalue = dbtotalvalue + rgeCell.Value
      End If
   Next rgeCell
   
   SUMVISIBLE = dbtotalvalue
End Function


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