Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Uncheck excel form control checkboxes with vba (code modification)

I need to uncheck the checkboxes of only the selected cells

Hello this code works perfect to uncheck the checkboxes of all the sheet. I need it to uncheck only the checkboxes of a specified selection. Could you help me? I have tried a lot of things and nothing works

`Sub Unchecker()
    Dim chkBox As Excel.CheckBox
    Application.ScreenUpdating = False
    For Each chkBox In ActiveSheet.CheckBoxes
        chkBox.Value = xlOff
    Next chkBox
    Application.ScreenUpdating = True
End Sub`

Thank you

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Pleas try it.

Sub Unchecker()
    Dim chkBox As Excel.CheckBox
    Application.ScreenUpdating = False
    For Each chkBox In ActiveSheet.CheckBoxes
        ' Top-left of CheckBox is in Selection
        If Not Intersect(chkBox.TopLeftCell, Selection) Is Nothing Then _
            chkBox.Value = xlOff
    Next chkBox
    Application.ScreenUpdating = True
End Sub
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading