COUNTVISIBLE

COUNTVISIBLE(rgeValues)
Returns the number of visible non blank cells.

rgeValues

REMARKS
* This function excludes hidden cells.
* You can use the built-in COUNT function to include hidden cells.
* You can use the user defined COUNTAVISIBLE function to
* You can use the user defined COUNTVISIBLEIFS function to
* Similar to the user defined functions AVERAGEVISIBLE, MAXVISIBLE, MEDIANVISIBLE, MINVISIBLE and SUMVISIBLE
* You could also use aggregate(2,5,range)
Public Function COUNTVISIBLE( _

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

Dim rgeCell As Range
Dim itotalcells As Integer

   Application.Volatile
   
   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

For instructions on how to add this function to a workbook refer to the page under Inserting Functions


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