+ Reply to Thread
Results 1 to 8 of 8

Toggle Macro on Button

  1. #1
    Registered User
    Join Date
    06-12-2010
    Location
    Hereford, England
    MS-Off Ver
    Excel 2003
    Posts
    73

    Toggle Macro on Button

    Hi Guys,

    How can I toggle this macro on a button click?

    Please Login or Register  to view this content.
    Thanks in advance

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Toggle Macro on Button

    Toggle it to do what?

  3. #3
    Registered User
    Join Date
    06-12-2010
    Location
    Hereford, England
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: Toggle Macro on Button

    Quote Originally Posted by Bob Phillips View Post
    Toggle it to do what?
    When you click the button the first time it unprotects the sheet and converts the list to range.
    What I want is that when you click the button again, it adds the list and protects the sheet.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Toggle Macro on Button

    Hi Baziwan;

    I don't know anything about ListObjects. I'm going to try and learn about them.
    But something like this should do what you want.
    Please Login or Register  to view this content.
    I would really like to see the finished macro, so when you have fixed mine, please post it back here.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Toggle Macro on Button

    Why not do it all at once?

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

    Re: Toggle Macro on Button

    Add a button from the Controls ToolBox then use this code
    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  7. #7
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Toggle Macro on Button

    Hi Roy;
    I really like your idea of changing the caption on the Button.
    What's the purpose of this line?
    Please Login or Register  to view this content.
    I'm using XL2002, so I don't have ListObjects, but I'd like to know why you hide it.

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

    Re: Toggle Macro on Button

    That line switches off the List Toolbar, it's not essential.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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