+ Reply to Thread
Results 1 to 3 of 3

Generic Current Object Reference Inside that Object's Code

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Generic Current Object Reference Inside that Object's Code

    I'd like to make some checkbox code that is generic so that I can cut/paste it from one checkbox to another without having to modify each time. I'm almost there, but there's one last thing. I'd like to make a generic current object call instead of the specific object call...in this code I would like to change CheckBox2.LinkedCell to something more generic.

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Generic Current Object Reference Inside that Object's Code

    The code doesn't know what checkbox the event is being processed for, except for the name of the Sub. There is an alternative approach to implementing events for several controls, if they all have the same code. The attached example [handle multiple buttons by creating a class.xls] comes from John Walkenbach, and shows how to implement a Class that handles an event for all instances of a specific control type. In this example, there is a userform with several command buttons, and there is one Sub to handle all clicks no matter what button it is.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    San Jose, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Generic Current Object Reference Inside that Object's Code

    Thanks, that makes sense. I was able to make things work like I wanted by moving this function to another call...no big deal.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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