|
谁能帮忙解释一下这里的所有代码意思
Sub 按钮13_单击()
If Sheets("主界面").[A1] = 1 And Sheets("SHEET1").[c20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表一").Visible = True
Sheets("表一").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 2 And Sheets("SHEET1").[d20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表二").Visible = True
Sheets("表二").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 3 And Sheets("SHEET1").[e20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表三").Visible = True
Sheets("表三").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 4 And Sheets("SHEET1").[f20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表四").Visible = True
Sheets("表四").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 5 And Sheets("SHEET1").[g20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表五").Visible = True
Sheets("表五").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 6 And Sheets("SHEET1").[h20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表六").Visible = True
Sheets("表六").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 7 And Sheets("SHEET1").[i20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表七").Visible = True
Sheets("表七").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 8 And Sheets("SHEET1").[j20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表八").Visible = True
Sheets("表八").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 9 And Sheets("SHEET1").[k20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表九").Visible = True
Sheets("表九").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
ElseIf Sheets("主界面").[A1] = 10 And Sheets("SHEET1").[l20] = 1 Then
ActiveWorkbook.Unprotect PASSWORD:="12345"
Sheets("表十").Visible = True
Sheets("表十").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
Else
MsgBox "你无权打开此表,请与系统管理员联系!", 1 + 64, "系统提示"
End If
End Sub
Sub 按钮1_单击()
ActiveWorkbook.Unprotect PASSWORD:="12345"
ActiveSheet.Visible = False
Sheets("主界面").Activate
ActiveWorkbook.Protect PASSWORD:="12345"
End Sub
Sub 按钮2_单击()
Sheets("主界面").Activate
End Sub
第一次接触VBA ,希望高手帮忙 |
|