+ Reply to Thread
Results 1 to 3 of 3

Dynamic user form

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Dynamic user form

    Hello,

    I am trying to create a user form which displays multiple ListBoxes, based on the value of a variable, as shown on the attached snapshot.
    In the example shown in the snapshot, the variable was 67, so I've got 67 ListBoxes.
    The ListBoxes, needed to be organized in columns of 15s as shown; The Size of the user form must vary to accomodate up to 20 columns.
    Could you plese advise?

    Thanks!
    Attached Images Attached Images

  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 user form

    Stating the obvious but with 20 columns the ListBoxes are going to be quite narrow.

    It should be a fairly simple task using an inner and outer loop.

    Create two loop variables where one will be the minimum of the number of boxes divided by 15 and the other the Integer of the number of boxes divided by 15 and rounded to the next highest number
    .
    Each pass through the loop should add a ListBox and set the Height and Width
    then set the TopIndex and LeftIndex of each box using the loop variables
    You'll need to create a scaling width variable so that you can adjust the width of each box depending on how wide your form is and how many columns you have.
    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.

  3. #3
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Re: Dynamic user form

    Richard,
    Thank you for looking into this.
    1. What would be the script to manipulate, for example the TopIndex?
    2. What would be the script to add a ListBox?
    3. Where do I keep these scripts? In a Module or in the corresponding UerForm?
    Thanks!

+ 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] Dynamic searchable user form.
    By thebeastslayer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2020, 05:54 AM
  2. Dynamic User Form
    By x_ampl1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-02-2020, 08:57 AM
  3. [SOLVED] How to get dynamic unique value for user form comb box from worksheet
    By bala04msw in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-31-2018, 07:45 AM
  4. [SOLVED] User form combo box to look up a dynamic named range
    By cobwebs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2014, 07:24 AM
  5. Freeze user form while creating many dynamic controls
    By richard.briggs in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-15-2014, 04:14 AM
  6. Create a Dynamic User Form
    By abhishekchak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2012, 06:53 AM
  7. [SOLVED] Adding Dynamic Text to a User Form
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2012, 01:38 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