+ Reply to Thread
Results 1 to 4 of 4

Making this macro run automatically when the worksheet tab is activated

  1. #1
    Registered User
    Join Date
    07-14-2014
    Location
    nyc
    MS-Off Ver
    2003
    Posts
    74

    Making this macro run automatically when the worksheet tab is activated

    Hello

    I currently have this macro running on a page when I click a button but would like it to do this automatically when i switch to the tab from another one. How do I change the code to make this happen?

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Making this macro run automatically when the worksheet tab is activated

    Use the Workbook_SheetActivate event

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-14-2014
    Location
    nyc
    MS-Off Ver
    2003
    Posts
    74

    Re: Making this macro run automatically when the worksheet tab is activated

    Would that go before or after the code I wrote? Or incorporated into it? And is there a way to do it without the message box?
    Thanks

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Making this macro run automatically when the worksheet tab is activated

    The message box was just there to show you it works. The Workbook_SheetActivate event is different than a subroutine, which is what you wrote. Your code, minus the sub and end sub would go inside it.

+ 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. Making a macro run automatically and update data in a sheet (not create a new one)
    By michaelhill94 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-11-2013, 10:59 AM
  2. Form with activated worksheet
    By jovir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2013, 07:52 AM
  3. making a macro run automatically on start and make code work only on first sheet
    By Alheksi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-12-2010, 04:18 AM
  4. Making a macro run automatically
    By edwardtong694 in forum Excel General
    Replies: 2
    Last Post: 08-24-2009, 08:57 AM
  5. Run a macro when a Worksheet is clicked/activated
    By Warren McGoldrick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2005, 06:06 PM

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