|
qwertyuiop357 发表于 2014-3-18 14:05
请问撤销的密码是多少
工作表保护密码就在按钮1的代码里 你试着理解下.- Private Sub CommandButton1_Click()
- On Error GoTo 10
- Dim n As String, t As Range
- Set sh = Sheets("设置")
- na = TextBox1.Text: ps = TextBox2.Text
- If na = "" Or ps = "" Then MsgBox "未输入用户名或密码,不能登录", "提示": Exit Sub
- Set t = sh.Range("a2:a65536").Find(na, , , xlWhole)
- If t Is Nothing Then GoTo 10
- If ps <> t.Offset(, 1).Text Then GoTo 10
- Me.Hide
- rs = t.Offset(, 2).Resize(, 24).Value
- With Sheets("表一")
- .Visible = -1
- .Unprotect "工作表保护密码"
- For c = 1 To 24
- .Columns(c).Locked = rs(1, c) - 1
- Next
- .Protect "工作表保护密码"
- End With
- Exit Sub
- 10:
- MsgBox "姓名或密码错误,不能登录", , "提示"
- End Sub
复制代码 |
|