Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi all,
Is there a way to count up how many formulae there are in workbook across all the tabs? Many thanks Andy |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
For a single sheet yes, press F5, select special then formulas, now right
click in the status bar to the far right and select count. Otherwise you need to use a macro ************************************************** **** Option Explicit Sub CountFormula() Dim sh As Worksheet Dim cell As Range Dim Count As Integer For Each sh In ActiveWorkbook.Sheets For Each cell In sh.UsedRange If cell.HasFormula Then Count = Count + 1 End If Next cell Next sh MsgBox "This workbook has " & Count & " formulas" End Sub ************************************************** *** -- Regards, Peo Sjoblom "Andy the yeti" wrote in message ... Hi all, Is there a way to count up how many formulae there are in workbook across all the tabs? Many thanks Andy |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Only with VBA code.
Sub CountFormulas() Dim TotalCount As Long Dim WSCount As Long Dim WS As Worksheet On Error Resume Next For Each WS In ActiveWorkbook.Worksheets WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t TotalCount = TotalCount + WSCount Next WS MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas." End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Andy the yeti" wrote in message ... Hi all, Is there a way to count up how many formulae there are in workbook across all the tabs? Many thanks Andy |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
thank you both !
"Chip Pearson" wrote: Only with VBA code. Sub CountFormulas() Dim TotalCount As Long Dim WSCount As Long Dim WS As Worksheet On Error Resume Next For Each WS In ActiveWorkbook.Worksheets WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t TotalCount = TotalCount + WSCount Next WS MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas." End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Andy the yeti" wrote in message ... Hi all, Is there a way to count up how many formulae there are in workbook across all the tabs? Many thanks Andy |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I think there's a slight bug in this.
If the worksheet doesn't have a formula, wscount retains its value from the previous count. Option Explicit Sub CountFormulas() Dim TotalCount As Long Dim WSCount As Long Dim WS As Worksheet On Error Resume Next For Each WS In ActiveWorkbook.Worksheets WSCount = 0 '<-- added WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t TotalCount = TotalCount + WSCount Next WS MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas." End Sub Chip Pearson wrote: Only with VBA code. Sub CountFormulas() Dim TotalCount As Long Dim WSCount As Long Dim WS As Worksheet On Error Resume Next For Each WS In ActiveWorkbook.Worksheets WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t TotalCount = TotalCount + WSCount Next WS MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas." End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Andy the yeti" wrote in message ... Hi all, Is there a way to count up how many formulae there are in workbook across all the tabs? Many thanks Andy -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Dave,
You're right. WSCount needs to be reset to zero for each sheet. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Dave Peterson" wrote in message ... I think there's a slight bug in this. If the worksheet doesn't have a formula, wscount retains its value from the previous count. Option Explicit Sub CountFormulas() Dim TotalCount As Long Dim WSCount As Long Dim WS As Worksheet On Error Resume Next For Each WS In ActiveWorkbook.Worksheets WSCount = 0 '<-- added WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t TotalCount = TotalCount + WSCount Next WS MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas." End Sub Chip Pearson wrote: Only with VBA code. Sub CountFormulas() Dim TotalCount As Long Dim WSCount As Long Dim WS As Worksheet On Error Resume Next For Each WS In ActiveWorkbook.Worksheets WSCount = WS.UsedRange.SpecialCells(xlCellTypeFormulas).Coun t TotalCount = TotalCount + WSCount Next WS MsgBox "You have " & Format(TotalCount, "#,##0") & " formulas." End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Andy the yeti" wrote in message ... Hi all, Is there a way to count up how many formulae there are in workbook across all the tabs? Many thanks Andy -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula Problem - interrupted by #VALUE! in other cells!? | Excel Worksheet Functions | |||
Hide formula | Excel Worksheet Functions | |||
Formula checking multiple worksheets | Excel Worksheet Functions | |||
Match / Vlookup within an Array formula | Excel Discussion (Misc queries) | |||
Help with macro formula and variable | Excel Worksheet Functions |