如何在Excel中计算具有特定名称的工作表?
您是否曾经尝试过计算以名字开头或包含特定单词的工作表的数量? 例如,计算名称以“ KTE”开头或包含“ KTE”的工作表的数量。 本文将提供帮助您显示问题的方法。
使用VBA代码对具有特定名称的工作表进行计数
快速查找工作表名称中包含特定单词的所有工作表
使用VBA代码对具有特定名称的工作表进行计数
以下VBA代码可帮助您计算工作簿中具有特定名称的工作表的数量。 请执行以下操作。
惊人的! 在 Excel 中使用高效的选项卡,如 Chrome、Firefox 和 Safari!
每天节省50%的时间,并减少数千次鼠标单击!
1。 按 其他 + F11 键打开 Microsoft Visual Basic应用程序 窗口。
2.在 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块,然后将以下VBA代码复制到“代码”窗口中。
VBA代码1:计算名称以“ KTE”开头的工作表
Sub CountWSNames()
Dim I As Long
Dim xCount As Integer
For I = 1 To ActiveWorkbook.Sheets.Count
If Mid(Sheets(I).Name, 1, 3) = "KTE" Then xCount = xCount + 1
Next
MsgBox "There are " & CStr(xCount) & " sheets that start with KTE", vbOKOnly, "KuTools for Excel"
End Sub
If you want to count number of worksheets contain “KTE”, please apply below VBA code 2.
VBA code 2: Count worksheets whose name contain “KTE”
Sub CountWSNames()
Dim I As Long
Dim xCount As Integer
For I = 1 To ActiveWorkbook.Sheets.Count
If InStr(1, Sheets(I).Name, "KTE") > 0 Then xCount = xCount + 1
Next
MsgBox "There are " & CStr(xCount) & " sheets that with KTE", vbOKOnly, "KuTools for Excel"
End Sub
Note: Please replace the
Word “KTE” with the one you need count number of worksheets based on.
3. Press the F5 key to run the code. Then a dialog box will pop up to tell you how many worksheets in current workbook start with “KTE” or contain “KTE”. See screenshots:
Number of worksheets whose name start with “KTE”:
Number of worksheets whose name contain “KTE”:
Quickly find all worksheets that contain specific word in sheet name.
This section will show you how to quickly find all worksheets that contain specific word in sheet name with Kutools for Excel.
Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.
1. After installing Kutools for Excel, the Kutools’ Navigation pane will be opened automatically on the left side of workbook. Or you can enable the pane by clicking Kutools > Navigation as below screenshot shown.
2. In the Workbook & Sheet section of the navigation pane, check the Filter box and enter the specific worksheet name you with find worksheets based on. Then all worksheets whose name contain the specific word are filtered and listed in the worksheet list box. See screenshot:
If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.
Related articles:
How to reference tab name in cell in Excel?
How to match the cell value with sheet tab name or vice versa in Excel?
How to open a specific worksheet by the selected value of a Combo Box in Excel?
Best Office Productivity Tools
Transform Hours into Minutes with Kutools for Excel!
Ready to supercharge your Excel tasks? Harness the power of Kutools for Excel - your ultimate time-saving tool. Streamline intricate tasks and glide through your data like a pro. Experience Excel at lightning speed!
Why You Need Kutools for Excel
🛠️ Over 300 Powerful Features: Kutools is packed with more than 300 advanced features, simplifying your work in over 1500 scenarios.
📈 Superior Data Processing: Merge cells, remove duplicates, and perform advanced data conversions – all without breaking a sweat!
⏱️ Efficient Batch Operations: Why put in extra effort when you can work smart? Import, export, combine, and tweak data in bulk with ease.
📊 Customizable Charts and Reports: Access a broad variety of additional charts and generate insightful reports that tell a story.
🗄️ Powerful Navigation Pane: Gain an advantage with the robust Column Manager, Worksheet Manager, and Custom Favorites.
📝 Seven Types of Drop-down Lists: Make data entry a breeze with drop-down lists of various features and types.
🎓 User-Friendly: A breeze for beginners and a powerful tool for experts.
Download Now and Soar Through Time with Excel!
Read More... Free Download... Purchase...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
Open and create multiple documents in new tabs of the same window, rather than in new windows.
Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Read More... Free Download... Purchase...
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。