Disable And Enable Button Using Excel Macro

Posted on 2004-11-23
Last Modified: 2013-12-25

I have one question, how to enable and disable button using excel macro. I have created two buttons on excel worksheet. For example, button A and button B. When i click at button A, macro will enable button B. Before this button B is disable. ok...

Question by:senico
    1 Comment
    LVL 15

    Accepted Solution


    On the Visual Basic toolbar click the Design Mode button and then the Control Toolbox
    Select button A and then on the Control Toolbox click View Code

    Then in the code for button A type this (you might have to change CommandButton2 to the name of your second button if you have changed it.

    CommandButton2.Enabled = Not CommandButton2.Enabled

    Now when you Click button A, button B will be enabled or disabled



    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now