ALLSHEETS

ALLSHEETS(rgeAddress)
Returns the min, max or sum of the identical cells across all worksheets.


ALLSHEETS_MIN

Returns the minimum value after scanning the same range on every worksheet in the workbook.

rgeAddressThe range to use on all the worksheets.

REMARKS
??

Public Function ALLSHEETS_MAX( _ 
         ByVal rgeAddress As Excel.Range) _
         As Double

Dim ws As Worksheet
Dim maxVal As Double
Dim first As Boolean
Dim rng As Range
    
   first = True
   
   For Each ws In ThisWorkbook.Worksheets
       On Error Resume Next
       Set rng = ws.Range(rgeAddress.Address)
       If Not rng Is Nothing Then
           If first Then
               minVal = Application.Min(targetRange)
               first = False
           Else
               minVal = Application.Min(minVal, Application.Min(targetRange))
           End If
       End If
       Set rng = Nothing
       On Error GoTo 0
   Next ws
   
   ALLSHEETS_MAX = maxVal
End Function


ALLSHEETS_MAX

Returns the maximum value after scanning the same range on every worksheet in the workbook.

Public Function ALLSHEETS_MAX( _ 
         ByVal rgeAddress As Excel.Range) _
         As Double

Dim ws As Worksheet
Dim maxVal As Double
Dim first As Boolean
Dim rng As Range
    
   first = True
   
   For Each ws In ThisWorkbook.Worksheets
       On Error Resume Next
       Set rng = ws.Range(rgeAddress.Address)
       If Not rng Is Nothing Then
           If first Then
               maxVal = Application.Max(rng)
               first = False
           Else
               maxVal = Application.Max(maxVal, Application.Max(rng))
           End If
       End If
       Set rng = Nothing
       On Error GoTo 0
   Next ws
   
   ALLSHEETS_MAX = maxVal
End Function


ALLSHEETS_SUM

Returns the sum of all the values after scanning the same range on every worksheet in the workbook.

Public Function ALLSHEETS_SUM( _ 
         ByVal rgeAddress As Excel.Range) _
         As Double

Dim ws As Worksheet
Dim total As Double
Dim targetRange As Range
    
   For Each ws In ThisWorkbook.Worksheets
       On Error Resume Next
       Set targetRange = ws.Range(rng.Address)
       On Error GoTo 0
       
       If Not targetRange Is Nothing Then
           total = total + Application.Sum(targetRange)
       End If
       
       Set targetRange = Nothing
   Next ws
   
   ALLSHEETS_SUM = total
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