Returns the number of visible non blank cells.


* This function excludes hidden cells.
* You can use the COUNT 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 COUNTVISIBLE
* You could also use aggregate(2,5,range)

Public Function COUNTVISIBLE( _ 
         ByVal rgeValues As Range) As Integer

Dim rgeCell As Range
Dim itotalcells As Integer

   For Each rgeCell In rgeValues
      If (rgeCell.EntireRow.Hidden = False) And _
         (rgeCell.EntireColumn.Hidden = False) Then
         itotalcells = itotalcells + 1
      End If

   Next rgeCell
   COUNTVISIBLE = itotalcells
End Function

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