+ Reply to Thread
Results 1 to 5 of 5

autorun a macro

Hybrid View

  1. #1
    Smudge
    Guest

    autorun a macro

    Hello,

    I'm new to Excel but used Lotus 123 version 2 many more years ago than I
    would like to admit. Forgot most of what I knew about writing macros but do
    remember that macros could linked to a key or to the opening of the
    spreadsheet.

    I have just started to use macros with Excel (I'm at the recording stage,
    but going into the script to try to work out what it does)

    Can anyone help me with code to invoke the macro as soon as the worksheet is
    opened please. Please, please, please be gentle and explain it in simple
    terms as the brain runs a lot slower these days.

    Many thanks
    --
    Smudge

  2. #2
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    Within the Visual Basic Editor (Alt-F11), click on the ThisWorkbook and enter this into the main window:

    Private Sub Workbook_Open()

    MsgBox ("This Macro Run on Open")

    End Sub

    Close the Visual Basic Editor, Save the Worksheet, Close it and Open it
    Google is your best friend!

  3. #3
    Smudge
    Guest

    Re: autorun a macro

    Thank you, I wasn't expecting an answer so quickly. will give it a go and get
    back to you.

    Many Many thanks
    --
    Smudge


    "Bearacade" wrote:

    >
    > Within the Visual Basic Editor (Alt-F11), click on the ThisWorkbook and
    > enter this into the main window:
    >
    > Private Sub Workbook_Open()
    >
    > MsgBox ("This Macro Run on Open")
    >
    > End Sub
    >
    > Close the Visual Basic Editor, Save the Worksheet, Close it and Open it
    >
    >
    > --
    > Bearacade
    >
    >
    > ------------------------------------------------------------------------
    > Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
    > View this thread: http://www.excelforum.com/showthread...hreadid=570565
    >
    >


  4. #4
    Robert
    Guest

    Re: autorun a macro

    Smudge, Bearcade's code works
    --
    Robert




  5. #5
    Smudge
    Guest

    Re: autorun a macro

    Thank you both. As always so impressed that people give up their time and
    knowledge so freely!
    --
    Smudge


    "Robert" wrote:

    > Smudge, Bearcade's code works
    > --
    > Robert
    >
    >
    >


+ 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