其他分享
首页 > 其他分享> > VBA:全选 全不选复选框

VBA:全选 全不选复选框

作者:互联网

Sub qx()
For Each chk In ActiveSheet.CheckBoxes
        If chk.Caption = "1.7" Then   '选中了
             chk.Value = 1
        End If
        If chk.Caption = "1.6" Then '选中了
             chk.Value = 1
        End If
        If chk.Caption = "1.5" Then   '选中了
             chk.Value = 1
        End If
        If chk.Caption = "1.4" Then   '选中了
             chk.Value = 1
        End If
        If chk.Caption = "1.3" Then   '选中了
             chk.Value = 1
        End If
        If chk.Caption = "1.2" Then   '选中了
             chk.Value = 1
        End If
        
        If chk.Caption = "1.1" Then  '选中了
             chk.Value = 1
        End If
        If chk.Caption = "1.0" Then  '选中了
            chk.Value = 1
        End If
        
    Next

Call chushi2
End Sub
Sub qbx()
For Each chk In ActiveSheet.CheckBoxes
        If chk.Caption = "1.7" Then   '选中了
             chk.Value = 0
        End If
        If chk.Caption = "1.6" Then '选中了
             chk.Value = 0
        End If
        If chk.Caption = "1.5" Then   '选中了
             chk.Value = 0
        End If
        If chk.Caption = "1.4" Then   '选中了
             chk.Value = 0
        End If
        If chk.Caption = "1.3" Then   '选中了
             chk.Value = 0
        End If
        If chk.Caption = "1.2" Then   '选中了
             chk.Value = 0
        End If
        
        If chk.Caption = "1.1" Then  '选中了
             chk.Value = 0
        End If
        If chk.Caption = "1.0" Then  '选中了
            chk.Value = 0
        End If
        
    Next

Call chushi2

End Sub

 

标签:VBA,End,Sub,chk,Value,Caption,全选,选中,全不选
来源: https://www.cnblogs.com/xkdn/p/15115357.html