+ Reply to Thread
Results 1 to 5 of 5

Two macro's assigned to one checkbox

  1. #1
    Registered User
    Join Date
    02-27-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    70

    Two macro's assigned to one checkbox

    Hello,

    I recorded these 2 macro's:
    Please Login or Register  to view this content.
    I Need to assign these to macro's to one checkbox. Macro1 when checkbox is checked, and Macro2 when checkbox is unchecked.

    Thanks!

  2. #2
    Valued Forum Contributor PaulSP8's Avatar
    Join Date
    11-21-2017
    Location
    Chorley, England
    MS-Off Ver
    2013 & 2021
    Posts
    437

    Re: Two macro's assigned to one checkbox

    Create your Tickbox on the sheet, link it to a cell (I've used A1 for this);

    Assign this macro (by right clicking on it) to it;

    Please Login or Register  to view this content.
    You can of course change the A1 reference to whatever works for you

    Does that work for you?

  3. #3
    Registered User
    Join Date
    03-23-2011
    Location
    West Bromwich, England
    MS-Off Ver
    Excel 2007 & 2013 in Azure
    Posts
    83

    Re: Two macro's assigned to one checkbox

    If it's an ActiveX CheckBox...


    Enter Design Mode (Developer Tab > Controls > Design Mode)
    Right click on the checkbox, select View Code


    A click event similar to the following will be created:
    Please Login or Register  to view this content.
    Modify it to (as appropriate):

    Please Login or Register  to view this content.
    I'd suggest more meaningful names be used for the CheckBox & Macros.

    Regards

    Tooley

  4. #4
    Registered User
    Join Date
    02-27-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    70

    Re: Two macro's assigned to one checkbox

    Tx! exactly what i was looking for

  5. #5
    Registered User
    Join Date
    02-27-2019
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    70

    Re: Two macro's assigned to one checkbox

    Your sollution works fine but if i protect the sheet is gives a 'run-time error "1004": application-defined or object-defined error.
    Do you have any idea how i can solve that?

+ 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. Macro assigned to button does not stay assigned
    By tuscan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2017, 02:22 AM
  2. Excel Upgrade to 2013, Macro runs erratically with macro assigned to button (shape)
    By sspatriots in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2016, 07:23 PM
  3. Replies: 5
    Last Post: 09-09-2014, 07:18 PM
  4. Assigned Macros don't stay assigned?!?
    By paesu57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2014, 10:49 AM
  5. Trying to scale a form checkbox in a macro, don't know how to get checkbox name
    By tstruch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2014, 12:14 AM
  6. [SOLVED] how to execute a macro assigned to a checkbox in vba
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-29-2013, 01:15 PM
  7. Assign a macro to automatically find the last assigned other macro
    By tperkins1973 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2012, 06:39 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