如何在Excel中删除多个表(4种方法)

  • Share This
Hugh West

在Microsoft Excel中,我们可以用不同的简便方法删除多张工作表。 我们可以从上下文菜单或Excel功能区应用选项,有时也可以插入VBA代码来满足我们的要求。 在这篇文章中,你将通过适当的例子和图解来了解在Excel中删除多张工作表的所有合适方法。

实践工作手册

下载以下工作手册和练习。

删除多个表.xlsx

在Excel中删除多个表的4种简单方法

1.使用功能区选项删除Excel中的多个表

丝带 选项,我们可以删除多个工作表。

步骤。

  • 选择我们要删除的表,按住 移交 钥匙。

  • 现在去到 首页 选项卡,并选择 删除 > 删除工作表 .

  • 将打开一个对话框。
  • 点击 认可 .

  • 然后我们可以看到,被选中的工作表被删除了。

2.使用工作表选项来删除Excel中的多个工作表

2.1 对于相邻的工作表

我们需要按照以下步骤来删除相邻的多个工作表。

步骤。

  • 通过按住 移交 键,用鼠标选择我们要删除的第一张和最后一张。

  • 右键点击 你的鼠标按钮放在工作表标签上,并选择 删除 .

  • 最后,这些床单被删除。

2.2 对于不相邻的工作表

我们还可以删除不相邻的工作表。

步骤。

  • 选择我们要删除的单元格,按 键盘 钥匙。

  • 现在在 "工作表 "标签上。 右键点击 鼠标上,并选择 删除 .

  • 弹出一个对话框。
  • 点击 认可 并看到结果。

3.通过混合键盘删除多个工作表

在Excel中通过按键盘删除多个工作表是最简单和最快速的方法之一。 我们只需要选择工作表。 右键点击 在工作表标签上,按 D 这些纸张将被删除。

4.插入VBA代码来删除多个Excel表

4.1 删除所有工作表,保留活动表

VBA 是删除除活动工作表以外的所有工作表的最合适方法之一。

步骤。

  • 从工作表标签,选择活动的工作表。 右键点击 鼠标上,并选择 查看代码 .

  • 现在复制以下代码并将其粘贴到你的VBA模块中。
 Option Explicit Sub deletemultiplesheets() Dim spreadsheet As Worksheet Application.DisplayAlerts = False For Each spreadsheet In Sheets If spreadsheet.Name ActiveSheet.Name Then spreadsheet.Delete End If Next spreadsheet Application.DisplayAlerts = True End Sub 

  • 点击 运行 选项,我们会看到所有的工作表都被删除了,除了活动的那个。

阅读更多:如何使用VBA删除Excel工作表(10 VBA宏)。

4.2 删除带有特定文本字符串的工作表

我们可以轻松地删除所有带有特定文本字符串的工作表。

步骤。

  • 从工作表标签中选择工作表。
  • 现在 右键点击 鼠标上,并选择 查看代码 .

  • 然后复制以下代码并将其粘贴到你的VBA模块中。 并点击 运行 选择。
 Option Explicit Sub DeleteSheetWithSameName() Dim spreadsheet As Worksheet Application.DisplayAlerts = False For Each spreadsheet In sheets If spreadsheet.Name Like "*" & "Sales1" & "*" Then MsgBox spreadsheet.Name spreadsheet.Delete End If Next spreadsheet Application.DisplayAlerts = True End Sub 

  • 将弹出一个对话框进行确认,并选择 认可 .

  • 最后,我们可以看到选定的工作表和选定的文本字符串被删除。

总结

通过这些方法,我们可以很容易地删除Excel中的多个工作表。 这里添加了一个练习工作簿。 来吧,试一试。 欢迎提出任何问题或建议任何新方法。

Hugh West is a highly experienced Excel trainer and analyst with over 10 years of experience in the industry. He holds a Bachelor's degree in Accounting and Finance and a Master's degree in Business Administration. Hugh has a passion for teaching and has developed a unique teaching approach that is easy to follow and understand. His expert knowledge of Excel has helped thousands of students and professionals worldwide improve their skills and excel in their careers. Through his blog, Hugh shares his knowledge with the world, offering free Excel tutorials and online training to help individuals and businesses reach their full potential.