VBA:判断复选框的选择状态 chk.value<>1未选择状态 chk.value=1选择状态
For Each chk In ActiveSheet.CheckBoxes If chk.Caption = "1.7" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.7" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.6" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.6" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.5" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.5" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.4" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.4" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.3" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.3" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.2" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.2" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.1" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.1" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If If chk.Caption = "1.0" And chk.Value = 1 Then '选中了 chk.Value = 0 ElseIf chk.Caption = "1.0" And chk.Value <> 1 Then '选中了 chk.Value = 1 End If Next