How to count number of named sheets.

Dunk4Divin

New Member
Joined
Aug 21, 2019
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi All

I have a workbook in which the tool bar and tabs are hidden when the workbook is being used by the user. It has an "Operators Instruction" sheet. This format is used for any number of sheets as required (depending on the part being manufactured). I have written code which duplicates the sheet and removes data images and shapes as necessary. The “master” sheet Tab is named "Gauge Instruction (1)" and each subsequent sheet has the Tab name plus the suffix number (x) as per normal

All sheets must have the information in the header “Gauge Instruction page X of Y pages”. I have the “X” from the current sheet name but not the “Y”. How can I count the number of sheets that have a Tab name starting “Gauge Instruction”.

I've tried using the Name Manager; naming the sheets "GIS" with "Refer To" as =GET.WORKBOOK(1)&T(NOW()) and this formula: =COUNTA(INDEX(GIS,0)) in a cell to count them but it fails to work am I missing something?

Any help will be most welcome!

Thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I might be oversimplifying the problem but since you seem to want a formula to count the number of Gauge Instruction sheets, the function below will count the number of workbooks in the file that end with ")"

VBA Code:
Function s_count() As Integer
s_count = 0
For Each sh In ActiveWorkbook.Sheets
    If Right(sh.Name, 1) = ")" Then
        s_count = s_count + 1
    End If
Next sh
End Function

So once you have that function in a module you could then put "=s_count()" into a cell in the workbook to get the count of the number of sheets whose name ends in ")". Does that work for you?

It could be modified to specifically count the number of sheets that begin with "Gauge Instruction" if that would be more accurate (in case you have other tabs that end with ")".
 
Upvote 0
Solution

Forum statistics

Threads
1,214,833
Messages
6,121,864
Members
449,052
Latest member
Fuddy_Duddy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top