+ Reply to Thread
Results 1 to 2 of 2

automatically running a macro by selecting a worksheet

  1. #1
    Registered User
    Join Date
    10-07-2006
    Posts
    1

    automatically running a macro by selecting a worksheet

    I have a workbook with many worksheets in it.
    I would like to make a macro run automatically whenever I click on particular worksheet (one of the many).
    The purpose is this:
    I change something within some other worksheets, and then whenever I click this particular worksheet I want a macro to make a reset to something.
    So It's simply a matter of making the macro run as soon as this worksheet is clicked.
    Does anybody know how it can be done?

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,921
    Put the macro in the worksheet_activate procedure:
    1. Right click the desired sheet tab, select View Code
    2. In the Code Pane, select "worksheet" from the OBJECT listbox
    3. In the adjacent PROCEDURE listbox, select WORKSHEET_ACTIVATE
    4. Paste your macro here
    When you're done it should look like:
    Private Sub Worksheet_Activate()
    .
    My macro code
    .
    End Sub
    Ben Van Johnson

+ 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