+ Reply to Thread
Results 1 to 8 of 8

Disable Button after 3 clicks

  1. #1
    Registered User
    Join Date
    07-01-2010
    Location
    Dallas, TX
    MS-Off Ver
    365 PC and Mac
    Posts
    64

    Disable Button after 3 clicks

    Hello- Promise, I searched before posting, but can't find a solution.

    Simple question which hopefully has a simple solution:

    - Is there a way to disable a button after a user has clicked it X number of times (3?)?

    Thanks in advance for the help.
    - Mr. Bill

  2. #2
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Disable Button after 3 clicks

    If the command button is on a form, you
    can track the number of button clicks in
    the button's Tag property, then disable
    when the count reaches 3.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: Disable Button after 3 clicks

    try this code

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-01-2010
    Location
    Dallas, TX
    MS-Off Ver
    365 PC and Mac
    Posts
    64

    Re: Disable Button after 3 clicks

    Hello- Thanks for the help. Couldn't get either of these to work.. Sure its something I'm doing wrong... here's what happened:

    Please Login or Register  to view this content.
    - This one just let me keep clicking. The button never disabled.

    Please Login or Register  to view this content.
    - This one threw me an error of: run-time error '424' Object Required


    Any thoughts? Thanks again!

  5. #5
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: Disable Button after 3 clicks

    Try instead with two buttons

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-01-2010
    Location
    Dallas, TX
    MS-Off Ver
    365 PC and Mac
    Posts
    64

    Re: Disable Button after 3 clicks

    Hello- Thanks... you gave me an idea...

    I just created 3 buttons. Each time one of them clicks, it executes the commands and then disables itself. After the 3 buttons, all the buttons are disabled.

    Sort of wonky, but it works for now.

    Thanks!

  7. #7
    Forum Contributor thameem127's Avatar
    Join Date
    04-06-2012
    Location
    Jeddah,Saudi Arabia
    MS-Off Ver
    Excel 2003,Excel 2007
    Posts
    321

    Re: Disable Button after 3 clicks

    Your welcome

    Press star if u like my coding and mark this thread as solved.

  8. #8
    Forum Contributor
    Join Date
    07-27-2012
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    198

    Re: Disable Button after 3 clicks

    Because you posted back my identical code, I assume you tried
    it and it failed because it did not register with your command button.
    Whatever you named your command button, that is the name you should use
    in your code. I chose "cmd1" for my button name.

    If your button is named "Command1". Go to that button's click event
    and add this.
    Please Login or Register  to view this content.
    and in your form's activate event, add this.
    Please Login or Register  to view this content.
    Why be wonky if you don't have to.
    Last edited by xLJer; 01-31-2013 at 07:43 PM. Reason: added code

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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