此代码在 C 列中放置复选标记或 X,并将字体更改为 Marlett:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("B5:B25", "D5:D25")) Is Nothing Then
Cancel = True 'Prevent going into Edit Mode
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("B5:B25", "D5:D25")) Is Nothing Then
Cancel = True 'Prevent going into Edit Mode
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "r"
Else
Target = vbNullString
End If
End If
End Sub