Unselect All CheckBoxes From Excel Workbook with VBA Macro

我是研究僧i 提交于 2019-12-01 04:28:29

If you have OLEObject-style (ActiveX) checkboxes, then:

Sub terranian()
    Dim o As Object
    For Each o In ActiveSheet.OLEObjects
        If InStr(1, o.Name, "CheckBox") > 0 Then
            o.Object.Value = False
        End If
    Next
End Sub

EDIT1:

If they are forms checkboxes , then the following will work:

Sub clearcheck()
    Dim sh As Worksheet
    For Each sh In Sheets
        On Error Resume Next
            sh.CheckBoxes.Value = False
        On Error GoTo 0
    Next sh
End Sub
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!