+ Reply to Thread
Results 1 to 4 of 4

Assigning a macro to a button

  1. #1
    Registered User
    Join Date
    05-06-2018
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    11

    Question Assigning a macro to a button

    Hi,

    I know you can assign a macro to a button to make easier but can you add some code to prevent the user from clicking it twice and making a mess?

    Thanks
    psychotrends

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,470

    Re: Assigning a macro to a button

    .
    You can add this line at the bottom of your macro :

    CommandButton1.Enabled = False

    Note that CommandButton1 is the name of your button. So if you have called your button MyButtonForMyMacro ... then the command would be MyButtonForMyMacro.Enabled = False

    At some point in your project you will need to re-enable the button for future use.

  3. #3
    Registered User
    Join Date
    05-06-2018
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    11

    Thumbs up Re: Assigning a macro to a button

    Thanks a lot.
    It worked!

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,470

    Re: Assigning a macro to a button

    You are welcome.

+ 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. Assigning macro to each button to zip files dependent on button name
    By mduff3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-29-2014, 02:55 AM
  2. Assigning a macro to a button
    By bugmenot in forum Excel General
    Replies: 4
    Last Post: 01-12-2009, 10:10 PM
  3. Assigning a macro to a button
    By Nigel Drinkwater in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2006, 08:10 AM
  4. [SOLVED] assigning a macro to a button
    By Darby in forum Excel General
    Replies: 3
    Last Post: 02-10-2006, 01:10 PM
  5. assigning macro to button
    By BorisS in forum Excel General
    Replies: 2
    Last Post: 09-12-2005, 01:05 AM
  6. [SOLVED] Assigning macro to button
    By d in forum Excel General
    Replies: 0
    Last Post: 08-22-2005, 09:05 AM
  7. Assigning a macro to a button
    By Junkyard Engineer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2005, 11:05 AM
  8. Assigning a Macro to a Button
    By cybercab in forum Excel General
    Replies: 3
    Last Post: 04-11-2005, 03:54 AM

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