+ Reply to Thread
Results 1 to 12 of 12

Check/Uncheck all checkboxes

  1. #1
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166

    Check/Uncheck all checkboxes

    I have a worksheet with 17 check boxes, and I'm trying to develop a macro to check all, and another to uncheck all. Once I figure out one, I can certainly do the other, so we'll just work with the UncheckAll maco. Here's the code I have:

    Please Login or Register  to view this content.
    Plain and simple, it isn't working. The debugger highlights:
    ActiveSheet.Shapes("CheckBoxi").Value = xlOff

    Any suggestions? Thanks!

  2. #2
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166
    Also, is there a way to manipulate the 'enabled' property of a checkbox through vba?

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello JChandler22,

    Here is a macros to clear all the Checkboxes on the ActiveSheet.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello JChandler22,

    You can enable or disable the Checkbox by using the collection index number or the name of the Checkbox.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  5. #5
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166
    Hmm, the first one didn't work for some reason... I copied and pasted directly (except for the sub name). Here's exactly what I have:

    Please Login or Register  to view this content.
    I'll try your second suggestion and let you know how that goes... thanks for your help!

  6. #6
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166
    Neither seemed to work.

    Would it make a difference whether I'm using the checkbox from the 'Control Toolbox' toolbar vs the 'Forms' Toolbar?

    I think the ones I'm using are from the Control Toolbox toolbar.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello JChandler22

    Disregard that last post. I posted the wrong code. Here is the code for Control Toolbox Checkboxes...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Last edited by Leith Ross; 07-12-2007 at 03:16 PM.

  8. #8
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166
    Awesome... thank you SO much.

    Any more ideas about being able to enable/disable a checkbox thru vba?

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello JChandler,

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  10. #10
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166
    Great, that works too! Thanks so much!

  11. #11
    Forum Contributor
    Join Date
    06-25-2007
    Posts
    166
    Again on enabling/disabling checkboxes...

    I'm now trying to develop a macro that will enable ALL checkboxes in one go, and I'm trying to use a for/next function. It's not working....

    Please Login or Register  to view this content.
    I have 17 checkboxes, numbered from 1 to 17. You might be able to follow my logic from the code above, but hopefully you might also be able to spot where I'm going wrong.

    Many thanks in advance...

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello JChandler22,

    If you are using the ComboBox's LinkedCell property, you only need to set the cell's value to true or false...
    Please Login or Register  to view this content.
    If not then use this code...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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