+ Reply to Thread
Results 1 to 4 of 4

Worksheet_Activate () - Need to work when any worksheet is activated

  1. #1
    Registered User
    Join Date
    03-25-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    21

    Worksheet_Activate () - Need to work when any worksheet is activated

    Hi All,

    I have this code sitting in Sheet2 of my workbook:

    Please Login or Register  to view this content.
    The code kicks in when I activate sheet2 (that is where I want the code to work), but what I need is for the code to update sheet2 whenever any of my worksheets are activated. Help...?

    JM

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Worksheet_Activate () - Need to work when any worksheet is activated

    Hi there,

    Insert the following code into the "ThisWorkbook" VBA CodeModule:


    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    03-25-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Worksheet_Activate () - Need to work when any worksheet is activated

    Hi Greg,

    That worked perfectly, but it threw up an unexpected problem, because the code causes a small load time now every time I select a new tab, timings are building up - so could I ask you this: Instead of before when I wanted the code to kick in when any worksheet, can I have it kick in only when I select sheet3?

    Regards,
    JM

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Worksheet_Activate () - Need to work when any worksheet is activated

    Hi again Jim,

    You can speed up the execution of the routine a little bit by adding the highlighted statements:

    Please Login or Register  to view this content.

    Or you could just change the first line of the routine to:

    Please Login or Register  to view this content.

    then insert the routine into the VBA CodeModule for Sheet 3, and delete it from the CodeModule for ThisWorkbook.

    And of course, you can even enter the "speeded-up" routine into just the CodeModule for Sheet 3.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

+ 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. Form with activated worksheet
    By jovir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2013, 07:52 AM
  2. I can not get Worksheet_Activate to work
    By anwaee2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-18-2012, 01:41 PM
  3. [SOLVED] Worksheet_Activate Doesn't Work On Chart Sheet
    By splendidus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2012, 04:55 AM
  4. how can worksheet_activate event of active sheet work of active workbook
    By tahir mahmood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2011, 08:19 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

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