我想避免使用Developer复选框,所以我找到了这个代码,但需要多个列作为复选框。专门栏4,5,6。
我知道它很简单。这是我正在使用的
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
'Column D
If .Column <> 4 Then Exit Sub
On Error Resume Next
If Asc(.Value) = 168 Then
.Font.Name = "Wingdings"
.Value = Chr(254)
Else: .Value = Chr(168)
End If
End With
End Sub
&#13;
由于
答案 0 :(得分:1)
只需测试列 D,E,F :
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
'Column D & E & F
If .Column = 4 Or .Column = 5 Or .Column = 6 Then
On Error Resume Next
If Asc(.Value) = 168 Then
.Font.Name = "Wingdings"
.Value = Chr(254)
Else
.Value = Chr(168)
End If
End If
End With
End Sub