在工作表保护功能允许用户盘算公式或改动单元格值的同时,却保留了单元格格式或数据。但若忘记了工作表保护密码,就不得不将工作表完整复制到新的工作簿中,复制来的工作表将不再受保护。不过,这样做可能会浪费很多时间并且不方便。那么如何撤销工作表保护密码呢?
现在请大家看清以下教程,几个简单的步骤,让你在几分钟之内轻松撤销工作表保护密码:
第一步:打开需要解除密码的工作簿文件,同时按Alt F11 打开VBA编辑器;
第二步:在VBA编辑器中,找到需要解除密码的工作表,右键单击,选择“视图代码”;
第三步:复制下面的代码到宏编辑器:
Sub PasswordBreaker()
’Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i)