+ Reply to Thread
Results 1 to 4 of 4

Cycle through objects in userform with for loop

  1. #1
    Registered User
    Join Date
    02-02-2015
    Location
    Portland
    MS-Off Ver
    2013
    Posts
    32

    Cycle through objects in userform with for loop

    Hello,

    I was wondering if it's possible to cycle through objects, checkboxes for example, in a userform by using a for loop. I've been naming the checkboxes "CB1" and "CB2" trying to get the for loop to pull them but to no avail. I've tried various thing including the code below, but haven't been able to get anything working. Is this possible?

    Please Login or Register  to view this content.
    In this example, I'm trying to hide Row 1 if Checkbox 1 is enabled. When dealing with a large amount of checkboxes in a userform, having this work would save a lot of time. In the mean time, I've been using this which works, but is a pain since I have 50+ checkboxes to go through:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Cycle through objects in userform with for loop

    Try this
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-02-2015
    Location
    Portland
    MS-Off Ver
    2013
    Posts
    32

    Re: Cycle through objects in userform with for loop

    Worked like a charm, thanks!

  4. #4
    Registered User
    Join Date
    02-02-2015
    Location
    Portland
    MS-Off Ver
    2013
    Posts
    32

    Re: Cycle through objects in userform with for loop

    Nvm, just forgot to change the name of my checkboxes, sorry!

    One more question on this. When initalizing the userform, I would like to have it already check or uncheck the checkboxes based on if the row was already hidden or not. Currently, this is what I have:

    Please Login or Register  to view this content.
    Any idea why this isn't working?
    Last edited by mason0567; 02-16-2015 at 06:59 PM.

+ 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] Until Loop cycle
    By arn0ldas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2014, 04:35 PM
  2. [SOLVED] Cycle through each row in Column A in a for loop for specific text?
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2013, 03:47 PM
  3. Loop cycle not copying correct cells
    By HDMI in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2013, 10:53 AM
  4. [SOLVED] is it possible to make the objects movable on userform when userform is loaded.
    By yeshwant_sur in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-29-2012, 05:14 AM
  5. [SOLVED] Cycle through images on UserForm
    By cdb in forum Excel General
    Replies: 2
    Last Post: 01-27-2005, 09:06 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