+ Reply to Thread
Results 1 to 8 of 8

Macro to select a range of checkboxes

  1. #1
    Registered User
    Join Date
    06-04-2013
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro to select a range of checkboxes

    I'm looking to create a macro to select a range of highlighted checkboxes. For example I have checkboxes in cells A1:A100 and want to select the checkboxes in A50:A100 and not the rest. I would highlight (left click A50 then shift click A100 to highlight them). Below is what I have so far, but it only selects the last checkbox not all that are highlighted. Any ideas what I'm doing wrong? If I change ".Select" to ".Delete" it will delete all checkboxes highlighted, but not select


    Sub Select_Checkboxs()
    Dim r As Range
    Dim chkbx As CheckBox

    Set r = Selection

    For Each chkbx In ActiveSheet.CheckBoxes
    If Not Intersect(r, chkbx.TopLeftCell) Is Nothing Then chkbx.Select
    Next chkbx

    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to select a range of checkboxes

    Do you want them checked? If yes, then try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    06-04-2013
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to select a range of checkboxes

    No I don't want them checked I just want them selected so I can delete, move, etc.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to select a range of checkboxes

    Try this...


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-04-2013
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to select a range of checkboxes

    If I select 30 or less checkboxes it seems to work. However, if I try more I get error 400.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to select a range of checkboxes

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-04-2013
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to select a range of checkboxes

    It works perfectly, thank you.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro to select a range of checkboxes

    You're welcome.

+ 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. Print Sheets based on checkboxes in UserForm, Checkboxes also control another macro
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 03-05-2013, 11:12 AM
  2. VBA code to select All checkboxes
    By itsmenick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-19-2012, 05:57 PM
  3. How to run a macro if checkboxes are checked in a range
    By franksonata in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2012, 07:31 AM
  4. CheckBoxes using Select Case
    By Blondegirl in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-25-2007, 09:10 AM
  5. How to select checkBoxes as a group in
    By Fendic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2005, 10: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