+ Reply to Thread
Results 1 to 4 of 4

activate/deactivate macros

  1. #1
    Registered User
    Join Date
    09-17-2009
    Location
    newport KY
    MS-Off Ver
    Excel 2007
    Posts
    2

    activate/deactivate macros

    I am wondering how to add a button on my custom toolbar to activate a macro and then I also want to be able to click the button again and deactivate the macro.

    The specific macro I want to activate and deactivate highlights the entire row and column so you can see it better. I want to be able to turn it on and off easily with a button click.

    Is it also possible to add a keyboard shortcut to activate/deactivate it?

    thanks,
    john

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: activate/deactivate macros

    Post your code
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-17-2009
    Location
    newport KY
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: activate/deactivate macros

    this is code i want to activate/deactivate with a button and shortcut key:
    Please Login or Register  to view this content.
    and this is other code already in my toolbar:
    Please Login or Register  to view this content.
    thanks

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: activate/deactivate macros

    Your know how to do the coding, so the turn on/off thing can be simple if you create cell value somewhere to check, or store a value in a public variable.

    In the sheet module:
    Please Login or Register  to view this content.
    And in a regular module:
    Please Login or Register  to view this content.
    Just attach that DoIt() module to a macro button to turn it off/on.

    Or, as an alternate, you could store a DoIt variable as "Boolean" and just check the status of that public variable as whether the activity should be occurring or not.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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