Excel工作表改名、加密码

打开Excel,按alt+F11,进入代码编辑页,左侧工程窗口,点击鼠标邮件,插入模块,右侧代码窗口输入如下代码:

Sub 工作表加密码保护()
Dim i As Long
For i = 1 To Sheets.Count
    Sheets(i).Protect "123"
Next
End Sub

Sub 取消工作表密码保护()
Dim i As Long
For i = 1 To Sheets.Count
    Sheets(i).Unprotect "123"
Next
End Sub
Sub 更改工作表名称()
Dim i As Long
For i = 1 To Sheets.Count
    Sheets(i).Name = Sheets(i).Range("c2")
Next
End Sub