+ Reply to Thread
Results 1 to 11 of 11

Checkbox runs macro when clicked, but not when button "clicks" it.

  1. #1
    Registered User
    Join Date
    02-01-2016
    Location
    Anywhere, Texas
    MS-Off Ver
    2013 Professional
    Posts
    6

    Checkbox runs macro when clicked, but not when button "clicks" it.

    I have set up a button to "click" checkboxes or change their value to 1. I am using form controls instead of ActiveX controls because I have Mac users who will be using the template.

    When I click the button the checkboxes are marked as if they are checked and the linked cells show TRUE, but the macro assigned to the checkbox does not run. When I manually click each checkbox, the assigned macro will run.

    Here's the code I use for the button:
    Please Login or Register  to view this content.
    Here's the code I use for each checkbox:

    Please Login or Register  to view this content.
    Any help is greatly appreciated! Thanks in advance!

    I also asked this question in another forum : https://www.mrexcel.com/forum/excel-...on-clicks.html
    Last edited by dominicb; 10-15-2018 at 02:24 PM. Reason: To add link to other forum asking same question.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,880

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    This is because, macro that change status of Checkbox does not physically trigger click event. But only changes state (i.e. underlying value stored).

    You can try calling each checkbox click code in your other code.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    02-01-2016
    Location
    Anywhere, Texas
    MS-Off Ver
    2013 Professional
    Posts
    6

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    Thanks so much for your reply! I just tried what you mentioned and it works when I run the button's macro in the editor. When I actually click the button, however, I see the same behavior. The checkboxes are marked but the code doesn't run. Am I doing something wrong?

    Here's the modified code just in case:
    Please Login or Register  to view this content.
    Thanks!

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,880

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    Can you upload sample workbook?

    To upload file, use "Go Advanced" button found at bottom right of quick reply/edit menu. Then find "Manage Attachments" hyperlink and click. It will launch new tab/window for managing uploads.

  5. #5
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    If you have less than 10 posts, do not try to copy and paste the link. Instead, type the link out in your thread.

    No further help to be offered, please, until the OP has complied with this request.
    Please familiarise yourself with the rules before posting. You can find them here.

  6. #6
    Registered User
    Join Date
    02-01-2016
    Location
    Anywhere, Texas
    MS-Off Ver
    2013 Professional
    Posts
    6

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    Thanks for letting me know. I have edited my original post to add where else I posted this question. As you mentioned, since I have fewer than 10 posts I provided the name of the forum and the post #. Should I add anything else?

    Also to Ck76, I attached the workbook. There's a lot going on with it because I'm still editing/fixing it. Thanks for your help!

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,880

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    Hmm? I don't see an attachment.

  8. #8
    Registered User
    Join Date
    02-01-2016
    Location
    Anywhere, Texas
    MS-Off Ver
    2013 Professional
    Posts
    6

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    I may have done it incorrectly before, sorry. Here's the attachment.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-01-2016
    Location
    Anywhere, Texas
    MS-Off Ver
    2013 Professional
    Posts
    6

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    I figured it out!!! I took a look at others who had similar issues and checked through my code for any issues. I didn't see anything, but I moved the modified code which simply calls the checkbox code (CheckBox2_Click in this example) from the worksheet to the same module containing the checkbox subs. I reassigned the module's code to the button. Now the code runs in the editor and using the button. Thanks so much for your help on this!!!

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,880

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    Glad you got it solved
    Sorry, I had missed your update with attachment.

  11. #11
    Registered User
    Join Date
    02-01-2016
    Location
    Anywhere, Texas
    MS-Off Ver
    2013 Professional
    Posts
    6

    Re: Checkbox runs macro when clicked, but not when button "clicks" it.

    No worries! Thanks for your willingness to help.

+ 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. How to make a user form choose a new worksheet when "OK" button is clicked
    By opusarlo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-06-2018, 01:58 PM
  2. [SOLVED] Need "Next" button to cycle through all matches if clicked repeatedly
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-25-2016, 06:55 AM
  3. Checkbox macro only runs on "True".
    By sick stigma in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2011, 04:28 PM
  4. Code for button runs and causes "1004" error on Exit and Save
    By TreePapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2010, 02:02 PM
  5. Checkbox runs same macro when clicked or unclicked
    By johnnywinter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2007, 02:23 AM
  6. Macro that runs entered value through "low" and "high" range
    By Vika.F in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2005, 03:35 AM

Tags for this Thread

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