提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中一次保护多个工作表?

假设您有一个包含多个工作表的工作簿,现在您需要保护所有工作表或某些特定的工作表(通常在Excel中),您只能使用保护工作表功能逐个保护工作表,但此方法非常繁琐,如果需要保护大量纸张,耗时。 如何快速轻松地在Excel中一次保护多张表格?

用VBA代码一次性保护所有页面

用Kutools for Excel一次保护多个表格

使用kutools for Excel一次解除多个工作表的保护


一次保护使用相同密码的多个工作表:

您订购的 Kutools for Excel保护工作表 取消保护工作表,您可以同时使用相同的密码保护或取消保护工作簿中的所有工作表。

文档保护,多重片状物,9

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


箭头蓝色右泡 用VBA代码一次性保护所有页面


使用以下VBA代码,您可以使用相同的密码一次性保护活动工作簿的所有工作表,请执行以下操作:

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

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

VBA代码:一次保护工作簿中的所有工作表:

Sub protect_all_sheets()
top: 
pass = InputBox("password?") 
repass = InputBox("Verify Password") 
If Not (pass = repass) Then 
MsgBox "you made a boo boo" 
Goto top 
End If 
For i = 1 To Worksheets.Count 
If Worksheets(i).ProtectContents = True Then Goto oops 
Next 
For Each s In ActiveWorkbook.Worksheets 
s.Protect Password:=pass 
Next 
Exit Sub 
oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets then running this Macro." 
End Sub

3。 然后按 F5 键运行代码,然后在提示框中输入受保护工作表的密码,请参阅屏幕截图:

文档保护,多sheets1-1

4。 点击 OK,然后再次输入密码以确认密码。

文档保护,多sheets2-2

5。 然后点击 OK,并且所有表单都使用相同的密码进行了保护。


箭头蓝色右泡 用Kutools for Excel一次保护多个表格

有时,您不想保护工作簿中的所有工作表,只想保护一些特定工作表,在这种情况下,上述代码将无法工作。 但是与 Kutools for Excel保护工作表 实用程序,您可以快速轻松地保护所有纸张和特定纸张。

Kutools for Excel : 与超过300方便的Excel加载项,在60天免费试用没有限制.

安装Kutools for Excel后,请按以下步骤操作:

1。 点击 企业服务 > 保护工作表,看截图:

文档保护,多sheets3-3

2。 在 保护工作表 对话框中,选择要保护的图纸。 (默认情况下,将检查当前工作簿中的所有工作表。)请参见屏幕截图:

文档保护,多sheets4-4

3。 并点击 OK,然后在“保护工作表”对话框中键入并确认密码。 看截图:

文档保护,多sheets5-5

4。 然后点击 OK,选定的工作表已被保护。

单击保护工作表以了解有关此功能的更多信息。


箭头蓝色右泡 使用kutools for Excel一次解除多个工作表的保护

你怎么能同时在工作簿中保护多个受保护的工作表? 当然, Kutools for Excel 还提供了 取消保护工作表 实用程序让您立即取消它们的保护。

Kutools for Excel : 与超过300方便的Excel加载项,在60天免费试用没有限制.

请按以下步骤操作:

1。 打开包含受保护工作表的工作簿。

2。 然后点击 企业服务 > 取消保护工作表,看截图:

文档保护,多sheets6-6

3。 在 取消保护工作表 对话框中,受保护的工作表被列入列表框中,然后单击 Ok 按钮,看截图:

文档保护,多sheets7-7

4。 然后a 取消保护工作表 弹出对话框提醒您输入您为保护工作表而创建的密码,请参阅截图:

文档保护,多sheets8-8

5。 输入密码后,单击 Ok,列表框中的所有选中的工作表都不受保护。

请注意: 工作表必须具有相同的密码。

了解更多关于此解除保护工作表功能。

立即下载并免费试用Kutools for Excel!


箭头蓝色右泡 演示:使用Kutools for Excel同时保护或取消保护所有工作表

Kutools for Excel:比200方便的Excel加载项,可以在60天免费试用。 下载并免费试用现在!


相关文章:

如何在Excel中一次解除多个工作表的保护?


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    George · 3 years ago
    I am trying to use this in a shared workbook but I get a Microsoft Visual Basic error "Run-time error '1004": Application-defined or object-defined error" I am just looking for suggestions on how to get around this. Any help would be appreciated
  • To post as a guest, your comment is unpublished.
    Geetha · 3 years ago
    Thanks for the wonder full tool to protect & unprotect all the sheets at a time.
    Please guide me I am able to unprotect all sheets in my work book at a time but when I run protect all sheets VBA Code then only first 4 sheets are protected & rest or left unprotected. Please help me to sort out the issue.
  • To post as a guest, your comment is unpublished.
    Mayhem · 3 years ago
    How do I mask the password using the VBA method?

    I can not find this information via google or F1 help files.

    Thanks in advance!
  • To post as a guest, your comment is unpublished.
    James MacPherson · 3 years ago
    Hi I used this code now I it wont accept my password to get back into my spreadsheet !!
  • To post as a guest, your comment is unpublished.
    S. Brown · 4 years ago
    I have chart tabs and worksheets in my Excel 2013 workbook. The VBA coding above works for the protecting the worksheets but not the separate chart tabs. How do i password protect the multiple chart tabs and multiple worksheets in my workbook? Thanks!
  • To post as a guest, your comment is unpublished.
    Zuber · 4 years ago
    Hey,

    I need some help, the above code was very helpful, but it locks the sort (auto filter as well) can you please provide code to solve that problem and also where it would be inserted.

    Thank you in advance.
  • To post as a guest, your comment is unpublished.
    N1ckole · 5 years ago
    Thank you! This is awesome, I was even able to modify the VBA code so that I could unprotect all sheets at once! :)

    Sub unprotect_all_sheets()
    top:
    pass = InputBox("password?")
    repass = InputBox("Verify Password")
    If Not (pass = repass) Then
    MsgBox "you made a boo boo"
    GoTo top
    End If
    For i = 1 To Worksheets.Count
    Next
    For Each s In ActiveWorkbook.Worksheets
    s.Unprotect Password:=pass
    Next
    Exit Sub
    oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets B4 running this Macro."
    End Sub
  • To post as a guest, your comment is unpublished.
    etan · 5 years ago
    when i activated this VBA, [b]hyperlink [/b]doesn't work. how can i make them work? tnx :)
  • To post as a guest, your comment is unpublished.
    Lightdemon · 5 years ago
    I am suddenly having the 1004 error as well. Anyone find a solution?
  • To post as a guest, your comment is unpublished.
    Lightdemon · 5 years ago
    I'm suddenly having the error 1004 issue. Have been using the macro for months now it randomly fails.
  • To post as a guest, your comment is unpublished.
    Scruffly Ghengis · 5 years ago
    when I imput the code it comes up with "run time error 1004?? highlighting the following in yellow...

    s.Protect Password:=pass
    • To post as a guest, your comment is unpublished.
      Lightdemon · 5 years ago
      I'm suddenly having the 1004 error as well. I have been using the macro for months but now it won't run.
      • To post as a guest, your comment is unpublished.
        Michelle McGregor · 2 years ago
        Hi,

        I was having this issue too. Turns out it can't run if you have all sheets selected in the workbook.

        Try selecting just one sheet and then running.
  • To post as a guest, your comment is unpublished.
    MrB · 5 years ago
    As Kristin said, how do you unprotect them all at once?
    • To post as a guest, your comment is unpublished.
      cz · 5 years ago
      So, how do I unprotect without kutools?
      • To post as a guest, your comment is unpublished.
        Admin-chivo · 5 years ago
        [quote name="cz"]So, how do I unprotect without kutools?[/quote]

        You can unprotect the worksheet without Kutools for Excel. You just need to right click on the sheet tab which you want to unprotect and click Unprotect Sheet command, and then enter your password. :-)
  • To post as a guest, your comment is unpublished.
    shweta · 5 years ago
    Thank you so much :-)
  • To post as a guest, your comment is unpublished.
    Kristin Dzugan · 5 years ago
    Great--so how to UNprotect them all at once? I'm an amateur, so I need more info.
    • To post as a guest, your comment is unpublished.
      N1ckol3 · 5 years ago
      Sub unprotect_all_sheets()
      top:
      pass = InputBox("password?")
      repass = InputBox("Verify Password")
      If Not (pass = repass) Then
      MsgBox "you made a boo boo"
      GoTo top
      End If
      For i = 1 To Worksheets.Count
      Next
      For Each s In ActiveWorkbook.Worksheets
      s.Unprotect Password:=pass
      Next
      Exit Sub
      oops: MsgBox "I think you have some sheets that are already protected. Please unprotect all sheets B4 running this Macro."
      End Sub
    • To post as a guest, your comment is unpublished.
      Admin_jay · 5 years ago
      [quote name="Kristin Dzugan"]Great--so how to UNprotect them all at once? I'm an amateur, so I need more info.[/quote]

      :-) You can easily unprotect them as http://www.extendoffice.com/product/kutools-for-excel/excel-unprotect-multiple-sheets.html