+ Reply to Thread
Results 1 to 5 of 5

Grouping Controls - then position entire group?

  1. #1
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Grouping Controls - then position entire group?

    Say I have 50 buttons in my userform, that are grouped.

    I have them laid out in a "checkerboard" pattern in my userform design mode, but I need to position them via code because my userform is made to fit the users resolution and these need to go on the right of the screen.
    With everything else so far, I just set their positions manually by each with something like:

    Please Login or Register  to view this content.
    I could do the same..however because there are literallt 50 or so buttons and needing a grid pattern this would be real tedious..so I figured I would ask if there is a way to keep the relationship of each in how I have them laid out in the designer..then position the whole group at once?

    Thanks in advance!

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Grouping Controls - then position entire group?

    You could put them in a Frame and then move the whole Frame.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Grouping Controls - then position entire group?

    I thought about using those frames before but I didn't understand their function. So you can place items in them?

    I've already positioned with code but I would love to clean things up and know for future reference


    Please Login or Register  to view this content.

    I will look into Frames more!

    Edit:

    Wow, so you drag items into a frame..I tried using them before and noticed the frame was always on top of the items..never thought to just drop my stuff in there. I could have used these in many places on my form....time to go back and clean stuff up.

    Thank you!

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Grouping Controls - then position entire group?

    Hey NewYears,

    All the things on a userform are called controls. You can "index" through them with code like:

    Please Login or Register  to view this content.
    If you know the number of the control on your userform you could go through them and set their Height, Left, Top and Width using this type of loop...

    For i = <first command button number> to <last command button number>
    userform1.controls(i).Height = <your formula based on i>
    Same for .left and .top and width...
    Next i

    Using this looping method and index of the controls might let you programmatically place those buttons.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: Grouping Controls - then position entire group?

    The Frame method worked perfect and let me remove tons of lines of code.

    MarvinP I will look into your suggestion too, trying to learn anything I can

    Thanks to you both I appreciate it.

+ 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. Replies: 1
    Last Post: 05-01-2014, 05:15 PM
  2. Manipulating Grouping controls with VBA
    By sportsguy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2013, 01:33 PM
  3. [SOLVED] Grouping controls
    By Mats Samson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2006, 05:25 AM
  4. [SOLVED] How to unprotect Grouping controls
    By Bob Laithwaite in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-17-2005, 09:06 PM
  5. [SOLVED] Grouping Userform Controls
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2005, 11:06 AM

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