值班登记表 我做的一个值班表,是用下面的代码做的选择,生动替换成符号:Option ExplicitPrivate Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Row <= 34 And Target.Row >= 4 And Target.Column <= 7 And Target.Column >= 2 Then
我做的一个值班表,是用下面的代码做的选择,生动替换成符号:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row <= 34 And Target.Row >= 4 And Target.Column <= 7 And Target.Column >= 2 Then
If Target.Count = 1 Then
If Target.Value <> "" Then
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
End If
End If
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
考勤 Target
End Sub
Sub 考勤(Rag As Range)
On Error Resume Next
If CStr(Rag.Value) = "" Then Exit Sub
Select Case CStr(Rag.Value)
Case "空白"
Rag.Value = ""
Case "李四"
Rag.Value = "△"
Case "张三"
Rag.Value = "○"
Case "王五"
Rag.Value = "☆"
Case "赵六"
Rag.Value = "◇"
Case "钱七"
Rag.Value = "□"
Case "猪八"
Rag.Value = "◎"
End Select
End Sub