+ Reply to Thread
Results 1 to 4 of 4

Choosing particular Userform controls array in a line of code.

  1. #1
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Choosing particular Userform controls array in a line of code.

    Dear all,

    Trust you're all well.

    I have a userform with 40 CheckBoxes and they are named as ChBxObj.

    I want to write a code that hides the controls that has the value of "Empty".

    This code goes from ChBxObj10 to ChBxObj40.

    The code I am using is the following:

    Please Login or Register  to view this content.
    The above code works well but I end up repeating it 30 times and creating a long code.

    Is there a way to create a much smaller code that loops the specified controls?

    Your assistance on this matter will be highly appreciated.

    Best regards,
    Filipe
    Last edited by pipoliveira; 01-19-2018 at 10:21 AM.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: Choosing particular Userform controls array in a line of code.

    Not tested as no sample document, but something along the lines of:
    Please Login or Register  to view this content.
    BSB
    Last edited by BadlySpelledBuoy; 01-19-2018 at 10:41 AM.

  3. #3
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Choosing particular Userform controls array in a line of code.

    Hi BSB,

    Thanks a million for your piece of code.

    Exactly what I was looking for. Works like a charm and I avoid to have a huge code for each single control.

    Really appreciate your help on this.

    Best regards,
    Filipe

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: Choosing particular Userform controls array in a line of code.

    Happy to help. Even happier it worked first time

    Thanks for the rep point.

    BSB

+ 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. [SOLVED] Inserting image into userform controls strictly through code
    By DJams in forum Excel Programming / VBA / Macros
    Replies: 42
    Last Post: 11-24-2023, 03:55 AM
  2. VBA userform for choosing colors: change Excel code to work for powerpoint?
    By submariner18 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2013, 05:49 PM
  3. Code for userform controls
    By Damperman in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-10-2013, 01:56 PM
  4. Deleting Userform controls through code (Help)
    By stuart010 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-26-2011, 10:12 AM
  5. Code to format number input in textbox controls (based on tag) in userform
    By asha3010 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-05-2010, 01:09 PM
  6. What controls choosing online v. offline Help?
    By joeu2004@hotmail.com in forum Excel General
    Replies: 2
    Last Post: 10-30-2005, 04:05 AM
  7. array of userform controls
    By Doug Glancy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2005, 09:40 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