Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: run a macro when i open a worksheet

  1. #1
    New Member
    Join Date
    May 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    please can someone tell me how i can run a macro as soon as a worksheet is opened Not Workbook)

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    You can place the name of your macro in the worksheet's activate event.


    Private Sub Worksheet_Activate()
    YourMacroNameHere
    End Sub



    Tom

  3. #3
    New Member
    Join Date
    May 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    sorry tom it doesnt seem to work
    can you explain in further detail
    Thanks

  4. #4
    MrExcel MVP
    Join Date
    Apr 2002
    Location
    Vancouver BC , Canada
    Posts
    6,259
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    -1 rt click on sheet tab
    -2 select view code
    -3 see left vb project window in vb editor
    -4 double click on sheet objects (i.e. sheet1)
    -5 Paste code into each sheet object
    -6 done
    <MARQUEE>...........Never be afraid to try something new. Remember, amateurs built the ark, professionals built the Titanic...............The easiest thing to find is fault, don't be easy !.. --Anonymous--...</marquee>

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Paste your code...
    When the sheet is activated, your code should run.
    Tom

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •