+ Reply to Thread
Results 1 to 6 of 6

How to have checkbox stay True when userform is closed and reopened

  1. #1
    Registered User
    Join Date
    12-03-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    50

    How to have checkbox stay True when userform is closed and reopened

    I plan to have a userform that will have 12 checkboxes that, when selected, it triggers an event where it will make visible a series of textboxes. For example:

    Checkbox1 when true will trigger TextboxA, TextboxB, TextboxC to be visible. When False, Textboxes A-C will be invisible. Values entered in Textboxes are tied to a Control Source
    Checkbox 2 when true will trigger TextBoxes D - F to be visible. When False, Textboxes D-F will be invisible.
    Checkbox 3.......etc

    My issue with checkboxes and userform is AFTER the userform is closed and reopened. A checkbox that is true when closed will appear false (uncheck) when its reopened. Where do I start writing code so that when the userform is initialized the checkboxes are the same when they last closed.

    Since I plan to have more than 12 checkbox I was hoping someone can advise a variable when the form is initialized, rather than the strategy to write individual code for each checkbox at startup.

    Thanks in advance.
    Gal403

  2. #2
    Registered User
    Join Date
    04-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: How to have checkbox stay True when userform is closed and reopened

    Are you actually closing the userform or are you hiding it?

  3. #3
    Registered User
    Join Date
    04-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: How to have checkbox stay True when userform is closed and reopened

    you might want to do a
    Please Login or Register  to view this content.
    for your 'ok' button
    instead of
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-03-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: How to have checkbox stay True when userform is closed and reopened

    Thanks for the quick reply. I will be closing the userform. It can't be hidden in the event the workbook has to close down.

  5. #5
    Registered User
    Join Date
    12-03-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: How to have checkbox stay True when userform is closed and reopened

    I just had a thought. Instead of checkboxes, how about using togglebuttons? Will the same issue occur?

  6. #6
    Registered User
    Join Date
    04-25-2014
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: How to have checkbox stay True when userform is closed and reopened

    oh i see, so if you check something to false, you want it to still be false after you close and reopen your workbook?

    This is the way i can see doing this:

    toggling the checkbox will change a value on a hidden sheet from 0 to 1.
    in UserForm_Initialize, refer to those values

+ 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. Userform Checkbox as a value when true
    By lcartwright in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2014, 12:42 PM
  2. Listbox items clear after worksheet is closed then reopened
    By skins0gr in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 05-24-2013, 12:02 PM
  3. [SOLVED] Checkbox must stay checked
    By Alexander_Golinsky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2012, 09:00 AM
  4. how to make checkbox true selecting then chaning 2nd box true when null
    By ferrum_equitis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2012, 01:13 PM
  5. Can't get checkbox to go true from another userform
    By mhill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2009, 12:10 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