+ Reply to Thread
Results 1 to 2 of 2

Dynamic userform help

Hybrid View

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

    Dynamic userform help

    Hi,

    I'm trying to create a dynamic userform. I want the user to be able to choose which options appear on the userform by selecting / unselecting checkboxes on a worksheet ("sheet1").

    In the attached workbook I've been able to make the userform add / remove 4 different checkboxes based on whether or not they have been selected. What I would like to be able to do now is:

    1). Have the 'Top' property of the checkboxes change based on whether or not the previous option was selected or not. At the moment, if you select options 1, 3 & 4, there is a big gap between 1 & 3 on the userform - I'd like there to be no gap).

    2). Have the userform itself resize based on the number of checkboxes that are added (eventually there will be many more than just 4 options).

    3). Have the userform save whatever format is selected so that every time the userform is displayed it shows the format that was chosen.

    4) Have the command button perform different actions based on whether or not the checkboxes on the userform are selected.

    I'm afraid I've hit the edge of my VBA expertise and would really appreciate any help.

    Cheers
    Gareth
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Dynamic userform help

    Hi,

    It's not really VBA per se which is is the requirement here. Rather you need to set up variables that will work out how many check boxes are selected and which they are. Then knowing that you can create other variables that will represent the top and left positions of the check boxes.

    I'd be inclined to write some standard excel formulae to work these out rather than try to do that with code, and then read these variables in the code, (it's always better in my opinion to use standard Excel functions where you can), and then set the top and left properties accordingly.

    The other approach would be to simply add new checkboxes at run time rather than trying to reposition pre-defined checkboxes.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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