+ Reply to Thread
Results 1 to 9 of 9

select all checkbox in a sheet

  1. #1
    Registered User
    Join Date
    08-05-2013
    Location
    borazjan
    MS-Off Ver
    Excel 2007
    Posts
    50

    select all checkbox in a sheet

    hi,
    i have a sheet that have 100 checkbox. i want to select(not check) all checkbox for change their property.

    how can i select all? (by macro or other way)

  2. #2
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: select all checkbox in a sheet

    Sub SelectAllCheckBox()
    Dim CB As CheckBox

    For Each CB In ActiveSheet.CheckBoxes
    If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name Then
    CB.Value = ActiveSheet.CheckBoxes("Check Box 1").Value
    End If
    Next CB

    End Sub

  3. #3
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: select all checkbox in a sheet

    and then use

    Sub Mixed_State()
    Dim CB As CheckBox
    For Each CB In ActiveSheet.CheckBoxes
    If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name And CB.Value <> ActiveSheet.CheckBoxes("Check Box 1").Value And ActiveSheet.CheckBoxes("Check Box 1").Value <> 2 Then
    ActiveSheet.CheckBoxes("Check Box 1").Value = 2
    Exit For
    Else
    ActiveSheet.CheckBoxes("Check Box 1").Value = CB.Value
    End If
    Next CB
    End Sub

  4. #4
    Registered User
    Join Date
    08-05-2013
    Location
    borazjan
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: select all checkbox in a sheet

    Quote Originally Posted by rishikrsaw View Post
    Sub SelectAllCheckBox()
    Dim CB As CheckBox

    For Each CB In ActiveSheet.CheckBoxes
    If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name Then
    CB.Value = ActiveSheet.CheckBoxes("Check Box 1").Value
    End If
    Next CB

    End Sub
    thanks, can you explain this macro row by row?
    i want to use this macro in my file, but i am not sure if this change other thing in my file or not.

    in other word, i want to use this macro to uncheck all checkbox in a sheet.

  5. #5
    Registered User
    Join Date
    08-05-2013
    Location
    borazjan
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: select all checkbox in a sheet

    Quote Originally Posted by rishikrsaw View Post
    and then use

    Sub Mixed_State()
    Dim CB As CheckBox
    For Each CB In ActiveSheet.CheckBoxes
    If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name And CB.Value <> ActiveSheet.CheckBoxes("Check Box 1").Value And ActiveSheet.CheckBoxes("Check Box 1").Value <> 2 Then
    ActiveSheet.CheckBoxes("Check Box 1").Value = 2
    Exit For
    Else
    ActiveSheet.CheckBoxes("Check Box 1").Value = CB.Value
    End If
    Next CB
    End Sub

    did not work

  6. #6
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: select all checkbox in a sheet

    First of all add, a checkbox to your sheet. You can add the checkbox by navigating to Developer Tab > Insert > Checkbox. Title this checkbox as “Select All”, this will be your Master Checkbox.

    Now, press Alt + F11, to open the VBA Editor, navigate to Insert > Module and paste the below code.

    Sub SelectAll_Click()
    Dim CB As CheckBox
    For Each CB In ActiveSheet.CheckBoxes
    If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name Then
    CB.Value = ActiveSheet.CheckBoxes("Check Box 1").Value
    End If
    Next CB
    End Sub

    Note: Make sure that the name of your Master Checkbox is “Check Box 1”. If not, then change the “Check Box 1” in the above code with the name of your Master Checkbox.

  7. #7
    Registered User
    Join Date
    08-05-2013
    Location
    borazjan
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: select all checkbox in a sheet

    Quote Originally Posted by rishikrsaw View Post
    First of all add, a checkbox to your sheet. You can add the checkbox by navigating to Developer Tab > Insert > Checkbox. Title this checkbox as “Select All”, this will be your Master Checkbox.

    Now, press Alt + F11, to open the VBA Editor, navigate to Insert > Module and paste the below code.

    Sub SelectAll_Click()
    Dim CB As CheckBox
    For Each CB In ActiveSheet.CheckBoxes
    If CB.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name Then
    CB.Value = ActiveSheet.CheckBoxes("Check Box 1").Value
    End If
    Next CB
    End Sub

    Note: Make sure that the name of your Master Checkbox is “Check Box 1”. If not, then change the “Check Box 1” in the above code with the name of your Master Checkbox.

    it just uncheck all,or check all. not select all!!
    i want to select all,not checkmark all.

  8. #8
    Forum Contributor
    Join Date
    11-12-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: select all checkbox in a sheet

    hey or selecting all the check box just simply press f5 then goto object and select option and ok

    as result u have selected all check box..............

  9. #9
    Registered User
    Join Date
    08-05-2013
    Location
    borazjan
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: select all checkbox in a sheet

    thanks, i solve my problem by other way. but thanks a lot

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How Do I select cells (with a checkbox) and sum them
    By spamunch in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-12-2011, 06:42 PM
  2. Select Value from Checkbox in an InputBox
    By farmassist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2010, 06:19 PM
  3. Select All Checkbox
    By ChainsawDR in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-28-2009, 08:52 AM
  4. checkbox on form reset from checkbox on sheet
    By raw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2005, 01:15 AM
  5. [SOLVED] How can I select one checkbox and have it unselect other ones?
    By Jake in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-09-2005, 11:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1