+ Reply to Thread
Results 1 to 8 of 8

Grouping over 100 Userform Labels

  1. #1
    Registered User
    Join Date
    10-16-2014
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    16

    Grouping over 100 Userform Labels

    I have a userform that has hidden labels that will show up depending on the value of a TextBox. I have over 100 labels and my code is getting really cluttered.

    There has to be a more efficient way of doing this. I'm fairly new to VB so any help would be appreciated. Thank you.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Grouping over 100 Userform Labels

    Complete guess here and Untested but have you tried

    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Registered User
    Join Date
    10-16-2014
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Grouping over 100 Userform Labels

    Got a Syntax error when I tried. Thanks though.

    Quote Originally Posted by Crooza View Post
    Complete guess here and Untested but have you tried

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-16-2014
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Grouping over 100 Userform Labels

    Maybe I could add Labels to a Worksheet, group them and then have them inserted to the UserForm. It might work but I'll have to mess with the formatting.

  5. #5
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Grouping over 100 Userform Labels

    Try this then

    Please Login or Register  to view this content.
    I justly ran it on one of mine and it worked for me

  6. #6
    Registered User
    Join Date
    10-16-2014
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Grouping over 100 Userform Labels

    Worked great, Thank you. It looks like I need to do some research and figure out what those commands do. I've never use For/Next. What does the Next t mean? +rep thanks again

    Quote Originally Posted by Crooza View Post
    Try this then

    Please Login or Register  to view this content.
    I justly ran it on one of mine and it worked for me

  7. #7
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Grouping over 100 Userform Labels

    Great. Glad it worked. You should mark this as solved (if not already).

    Re the for next loop, it's probably one of the most used pieces of code. The for section established the start and finish counter, the next tells it to repeat the loop with the next available number in the loop. So in your example we started at 37 set the label to label37 undertook the various things we wanted then told it to progress to 38 and do the the whole thing again until it got to the last number

  8. #8
    Registered User
    Join Date
    10-16-2014
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    16

    Re: Grouping over 100 Userform Labels

    Thanks again for your help. Marking as solved.

+ 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. Grouping axis labels
    By Marc_RSA in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 09-05-2013, 08:47 AM
  2. [SOLVED] Grouping Row labels of Pivot table using VBA
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-25-2013, 09:28 AM
  3. loop through userform labels?
    By losmi8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2011, 06:34 AM
  4. [SOLVED] Change values of labels in a userform through another userform
    By Zhennie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-29-2009, 05:34 AM
  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