+ Reply to Thread
Results 1 to 2 of 2

Custom Class Module for multiple UserForm controls?

  1. #1
    Registered User
    Join Date
    04-28-2017
    Location
    Sydney, Australia
    MS-Off Ver
    2016
    Posts
    14

    Custom Class Module for multiple UserForm controls?

    Hey guys,

    I am aware that you can set up custom class modules and use them in situations where you have multiple buttons in a Userform however I can't seem to understand how it works.

    As a very simplified version of the situation I am in, lets say I have a Userform with 20 buttons which swap between the captions "+" and "-" each time you click it. Instead of having a click event for each button, i want to has one subroutine where it will check the button that was just clicked and change it's caption if that makes sense. Is this possible?

    Additionally, is there a way to create a group of controls in which I can loop through?

    Thanks in advance!

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Custom Class Module for multiple UserForm controls?

    Have a read of this article.
    http://yoursumbuddy.com/category/classes/

    The userform already has a collection of controls. You can loop through that and identify controls by name or type.

    Or you can build your own collection, adding to it the relevant controls.
    Cheers
    Andy
    www.andypope.info

+ 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. Using Class Module for handling events of dynamically created controls
    By jagman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2018, 01:14 PM
  2. Place code in userform, module or class module
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-16-2017, 07:04 AM
  3. [SOLVED] Set textbox class module to look for null values on text box controls
    By buhwheet in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-10-2015, 01:04 PM
  4. [SOLVED] Converting to Class Modules (Userform Controls)
    By CraigsWorld in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2015, 05:45 PM
  5. [SOLVED] Userform & Dynamic Controls & Class Module
    By sarndt01 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 09-18-2014, 01:53 PM
  6. Replies: 1
    Last Post: 10-12-2012, 04:36 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