|
本帖最后由 327718098 于 2017-5-5 11:59 编辑
增加了mno3列辅助保存成绩,你把它们字体颜色设置为白色,或者隐藏这3列。要30秒后要修改我直接用的inpitbox,没有你的窗体,太麻烦,里面大密码你自己设置,如果要设置多个密码就改下这句If Val(InputBox("请输入修改密码", "提示")) <> 123,改为If Val(InputBox("请输入修改密码", "提示")) <> 123 or Val(InputBox("请输入修改密码", "提示")) <> "你的密码"就行,还有密码得设置为数子,要设置文字的话把val去掉就行。
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 3 And Cells(Target.Row, "I") <> "" Then
If (Now - Cells(Target.Row, "I")) > ("1900-1-0 0:00:30") Then
If Val(InputBox("请输入修改密码", "提示")) <> 123 Then
MsgBox "你无权修改"
Target.Value = Cells(Target.Row, "m")
Application.EnableEvents = True
End
End If
End If
End If
If Target.Column = 5 And Cells(Target.Row, "j") <> "" Then
If (Now - Cells(Target.Row, "j")) > ("1900-1-0 0:00:30") Then
If Val(InputBox("请输入修改密码", "提示")) <> 123 Then
MsgBox "你无权修改"
Target.Value = Cells(Target.Row, "n")
Application.EnableEvents = True
End
End If
End If
End If
If Target.Column = 7 And Cells(Target.Row, "k") <> "" Then
If (Now - Cells(Target.Row, "k")) > ("1900-1-0 0:00:30") Then
If Val(InputBox("请输入修改密码", "提示")) <> 123 Then
MsgBox "你无权修改"
Target.Value = Cells(Target.Row, "o")
Application.EnableEvents = True
End
End If
End If
End If
If Target.Column = 3 Then
Cells(Target.Row, "I") = Now
Cells(Target.Row, "M") = Target.Value
ElseIf Target.Column = 5 Then
Cells(Target.Row, "J") = Now
Cells(Target.Row, "n") = Target.Value
ElseIf Target.Column = 7 Then
Cells(Target.Row, "K") = Now
Cells(Target.Row, "o") = Target.Value
End If
Application.EnableEvents = True
End Sub
|
|