+ Reply to Thread
Results 1 to 10 of 10

class module for worksheet checkboxes - want to pass a variable

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    class module for worksheet checkboxes - want to pass a variable

    Hi All, hope you are all well.
    As the title suggests I am attempting to create a class action when a worksheet checkbox is clicked but I am hitting a wall.
    The checkboxes are added dynamically based on a row value
    Please Login or Register  to view this content.
    This works as required. I can loop through the created checkboxes but I am losing my way adding them to class module with the following. Normal Module
    Please Login or Register  to view this content.
    Class Module called cbClass
    Please Login or Register  to view this content.
    Ultimately I want to add the initials signature and date when the checkbox is clicked
    Any pointers appreciated. Workbook attached
    Attached Files Attached Files
    Last edited by nigelog; 11-26-2020 at 08:20 AM.

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: class module for worksheet checkboxes - want to pass a variable

    Checkboxes.Add adds a Form control, which, confusingly, is not the same as the MSForms controls. Form controls don't source automation events, so you can't declare one withevents - you'd just assign the same OnAction macro name to all of them.
    Rory

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: class module for worksheet checkboxes - want to pass a variable

    Ah.. Ok, thanks Rory. I'll see how I get on.

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: class module for worksheet checkboxes - want to pass a variable

    I can create the single "On Action" call of a macro but it refers to first Checkbox listed on sheet and not the actual clicked Checkbox. Can I call on some property of the clicked checkbox??

    Please Login or Register  to view this content.

  5. #5
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: class module for worksheet checkboxes - want to pass a variable

    Got it
    Please Login or Register  to view this content.

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: class module for worksheet checkboxes - want to pass a variable

    Do you have to use checkboxes...
    Alternative perhaps...Doubleclick cell...Needs error trapping code still
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 11-26-2020 at 08:12 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  7. #7
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: class module for worksheet checkboxes - want to pass a variable

    Hi Sintek, many thanks
    the powers that be live on checkboxes so I couldn't change. I am as far as passing the shape name via a variable so I'll see can I adapt above to copy and paste the shape

  8. #8
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: class module for worksheet checkboxes - want to pass a variable

    Sorted
    Please Login or Register  to view this content.

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: class module for worksheet checkboxes - want to pass a variable

    Just remember not to go over 31 characters when naming the controls.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,192

    Re: class module for worksheet checkboxes - want to pass a variable

    Modification...Doing it this way...allows for clear as well when clearing checkbox...
    Please Login or Register  to view this content.
    Last edited by sintek; 11-26-2020 at 08:57 AM.

+ 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] Private Function within class module/object, can't pass value of range as string
    By excelicus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2018, 03:33 PM
  2. How to pass a variable from one module to another
    By smit.etha in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2016, 06:05 AM
  3. Pass Boolean in Class Module
    By krishns in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2015, 04:38 AM
  4. [SOLVED] Checkboxes and collection for class module
    By Kiwoop in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2013, 04:55 AM
  5. Pass Variable From UserForm to Module
    By BLLMRC in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-24-2013, 12:41 PM
  6. [SOLVED] Pass date variable to another procedure/module
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2013, 10:16 PM
  7. Pass variable between subs within module
    By oOarthurOo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-01-2010, 04:58 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