+ Reply to Thread
Results 1 to 5 of 5

Dynamic Userform (resizing based on checkbox selection)

  1. #1
    Registered User
    Join Date
    11-09-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    32

    Dynamic Userform (resizing based on checkbox selection)

    Hi,

    I have a Userform with several checkboxes on it. I have added a button "Advanced" that opens a second Userform with additional checkboxes.

    What I want is for the user to be able to select specific checkboxes on the second userform and then for these to be added to the first userform which will then be resized. (The second userform is basically for advanced options that not every user will want to use. I'm trying to keep the first userform as basic as possible but allow more advanced users to add options to it).

    I found some code that adds checkboxes / resizes a userform based on the number of visible worksheets, but I can't figure out how to rework it to do the same based on checkboxes (I'm pretty new to VBA):

    Please Login or Register  to view this content.
    Any help will be greatly appreciated.

    Cheers,
    Gareth

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Dynamic Userform (resizing based on checkbox selection)

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Dynamic Userform (resizing based on checkbox selection)

    If you are pretty new to VBA you'd better explain why you want to do this unnecessary complicated manoeuvre.
    You can make visible all kinds of frames/checkboxes in a userform, dependent on who the user is or what the user does. Building a userform on the fly is - generally speaking - not such a good idea.



  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Dynamic Userform (resizing based on checkbox selection)

    Nor is have two userforms when one can be used

  5. #5
    Registered User
    Join Date
    11-09-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Dynamic Userform (resizing based on checkbox selection)

    I've attached an example worksheet as suggested.

    The user clicks the start button on Sheet1 to open the first userform ("userform1"). It has 4 checkboxes. The user can select any of these and then press start (In the example workbook this simply unloads the userform. In my actual workbook this will navigate to the correct sheet based on these selections).

    There is a button that says advanced options. When this is clicked it opens a second userform ("userform2") which has a bunch more checkboxes (in my actual workbook there could be up to ten). I'd like the user to be able to select these and for any boxes that are selected to then be added to Userform1.

    So for example, if the user checked "OPTION 5" & "OPTION 8", then when they returned to userform1 there would be 2 additional checkboxes (named "OPTION 5" & "OPTION 8"). Userform1 would also need to be resized to fit the extra boxes in.

    Like I said I'm kind of new to this whole programming thing so if anyone has any better ideas for how I should do all of this then I'd welcome those too.

    Thanks
    Gareth
    Attached Files Attached Files

+ 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