跳到主要内容

如何计算工作簿的张数?

您是否曾经考虑过如何计算工作簿中工作表的数量? 如果有很多工作表,一个接一个地计算它们是一件无聊的工作。 实际上,没有直接的公式来计算工作表的数量。 但是,在这里,我可以向您介绍一些有用且方便的技巧来解决此问题。

计算工作簿 SHEETS 函数中的工作表数

使用“定义名称”命令计算工作簿中的工作表数

使用VBA代码计算工作簿中的工作表数

通过导航窗格显示工作簿中的工作表数 好主意3

通过创建工作表列表来计算工作簿中的工作表数 好主意3


箭头蓝色右气泡计算工作簿 SHEETS 函数中的工作表数

如果您的 Excel 版本是 2013 或更高版本,您可以使用 SHEETS 函数获取当前工作簿的总工作表数。

选择一个空白单元格,然后键入 =床单() 进入其中,按 Enter 键获取张数。


箭头蓝色右气泡使用“定义名称”命令计算工作簿中的工作表数

在Excel中,您可以先将公式应用于“定义名称”功能,然后计算工作表的数量。

1。 启动您要计算工作表数量的工作簿。

2。 点击 公式 > 定义名称,请参见屏幕截图:

doc-count-of-sheets1

3. 而在 新名字 对话框中,在 名字 文本框,然后输入此公式 = GET.WORKBOOK(1)&T(NOW()) 文本框,请参见屏幕截图:

doc-count-of-sheets1

4。 然后点击 OK 关闭此对话框,并返回到工作表,然后键入此公式 = COUNTA(INDEX(CountSheets,0))(计数表 该公式中是您在第3步中定义的名称,您可以根据需要将其更改。)进入空白单元格,请参见屏幕截图:

doc-count-of-sheets1

5。 然后按 输入 键,您将获得当前工作簿中的工作表编号。

doc-count-of-sheets1


箭头蓝色右气泡使用VBA代码计算工作簿中的工作表数

如果您认为上述公式有些难以记住,那么这里有一个简单的VBA代码也可以为您提供帮助。

1。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

2。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

VBA代码:计算工作簿中的工作表数

Public Sub CountWorkSheets()
'Update 20140326
MsgBox "The total number sheets of this workbook: " & Application.Sheets.Count
End Sub

3。 然后按 F5 键执行此代码,然后会弹出一个提示框,告诉您工作表的总数,如以下屏幕截图所示:

doc-count-of-sheets1


箭头蓝色右气泡 通过导航窗格显示工作簿中的工作表数

如果你有 Kutools for Excel 安装后,您显然可以使用 旅游导航 窗格。

Kutools for Excel, 与超过 300 方便的功能,使您的工作更加轻松。 

免费安装 Kutools for Excel,请执行以下操作:

1。 点击 库工具 > 旅游导航 使之成为可能 导航窗格 在工作表的左侧。 看截图:
文档导航1

2。 然后点击 工作簿和工作表 选项卡,然后您可以查看窗格底部显示的活动工作簿中的工作表总数,也可以查看工作簿的可见和隐藏工作表数。 看截图:
文档导航2

旅游导航 窗格中,您可以在工作表之间切换,显示所有列标题,范围名称以及添加自动文本等。 单击此处了解更多详细信息。

箭头蓝色右气泡 导航窗格-列出并计算所有图纸


箭头蓝色右气泡 通过创建工作表列表来计算工作簿中的工作表数

如果您认为上述方法不方便,我可以为您介绍一个解决方案。

如果你已经安装 Kutools for Excel,您可以创建所有工作表的名称列表,然后选择它们以在状态栏中进行计数。

免费安装 Kutools for Excel,请执行以下操作:

1.启用要计数其工作表的工作簿,然后单击 Kutools 加 > 工作表 > 创建工作表名称列表。 看截图:
文档导航1

2.然后在弹出的对话框中,检查 包含超链接列表 选项,并且为了方便地选择工作表名称,您可以在3列或4列中显示工作表索引。 看截图:
文档计数表2

3。 点击 Ok,然后会创建一个工作表,其中所有工作表的名称都在所有工作表之前,而您只需要选择这些工作表名称,然后在 状态栏r.
doc kutools创建工作表名称列表3

实际上,这些工作表名称是可链接的,您可以单击一个工作表名称,然后快速链接到相对工作表。 与 创建工作表名称列表,您可以通过选中来创建工作表名称的可链接按钮 包含按钮和宏 选项 。 单击此处以了解有关创建图纸名称列表的更多信息。

箭头蓝色右气泡 创建图纸名称列表



Kutools for Excel:300 + Excel 中必须具备的功能, 从这里免费试用30天

非常好导航窗格-查找和替换

Kutools for Excel的进阶 查找和替换 功能,可以帮助您找到并
在多个工作表和工作簿中替换一个值。
doc查找并替换

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (16)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Thanks!
=Sheets() worked just fine!
Before I thought I must use VBA.
Saved a lot of trouble!
Rated 5 out of 5
This comment was minimized by the moderator on the site
Save the entire workbook in single pdf then u can find easily count the total no of pages.
This comment was minimized by the moderator on the site
I upgraded to Office 365 and now=COUNTA(INDEX(CountSheets,0)) always returns 1. Is there a fix for Excel 365 to get this to work?Thanks,
Jim...
This comment was minimized by the moderator on the site
=SHEETS() in Excel 365 returns 0.
=SHEETS(reference) - so what goes in "reference"?
This comment was minimized by the moderator on the site
Hi, gerland, in my office 365, the defined name method work as well. You can try the SHEETS function, I have updated it as the first one method in this tutorial.
This comment was minimized by the moderator on the site
=Sheets()  gives the answer. 
This comment was minimized by the moderator on the site
=sheets() works great
This comment was minimized by the moderator on the site
It Works only 2010 & Higher Version of Excel. Not Working In Excel 2007
This comment was minimized by the moderator on the site
Tried it on my 2007 version.
=COUNTA(countsheets)
works for me.
This comment was minimized by the moderator on the site
I like it. Thanks too much
This comment was minimized by the moderator on the site
Thank you so much for posting these directions!! I have a workbook with over 700 sheets and never knew there was a way for excel to count them for me. I used the first method and it worked absolutely perfectly!!
This comment was minimized by the moderator on the site
Great! Saved so much of my time!!
This comment was minimized by the moderator on the site
Hi, Thanks! This worked for me great in excel 2013 to count the number of sheets. Crazy that a formula is required to do this.
This comment was minimized by the moderator on the site
Sorry Freddy. Your first method using Formula > Define Name doesn't work. You got a typo somewhere or something
This comment was minimized by the moderator on the site
[quote]Sorry Freddy. Your first method using Formula > Define Name doesn't work. You got a typo somewhere or somethingBy smith[/quote] yes, instead of =COUNTA(INDEX(CountSheets,0)) You should write =COUNTA(INDEX(CountSheets;0))
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations