July 22, 2024


Welcome to the core

Count formulas in a workbook

This bit of code will count how many formulas you have used in a workbook, will display a message box of the count and the workbook name!


Sub FormulaCount()
Dim ws As Worksheet
Dim rCheck As Range
Dim lCount As Long

On Error Resume Next
For Each ws In Worksheets
Set rCheck = Nothing
Set rCheck = ws.UsedRange.SpecialCells(xlCellTypeFormulas)
If Not rCheck Is Nothing Then lCount = _
ws.UsedRange.SpecialCells(xlCellTypeFormulas).Cells.Count + lCount
Next ws
On Error GoTo 0

MsgBox “There is currently ” & lCount & ” formulas in ” & ThisWorkbook.Name
End Sub

Copyright © All rights reserved. | Newsphere by AF themes.