VBA MOD 01 Project Acvtivity : Count total number of formulas in Workbook

 Option Explicit

Public Sub Count_WB_formulas_error_Handling()

Dim Sh As Worksheet

Dim CounterWS As Double

Dim CounterGlobal As Double


For Each Sh In ThisWorkbook.Worksheets

    On Error GoTo Errorhandle

    

      CounterWS = Sh.Cells.SpecialCells(xlCellTypeFormulas).Count

Lable1:  CounterGlobal = CounterGlobal + CounterWS

    

Errorhandle:

    If Err.Number = 1004 Then

    CounterWS = 0

    Resume Lable1

    End If

    

Next Sh


MsgBox CounterGlobal


End Sub



Comments

Popular posts from this blog

VBA01 Copy Resize Variably Sized Ranges

VBA MOD01 Passing Arguments to sub procedures (ByRef , By Val)

PY MOD01 Lecture 01