+ Reply to Thread
Results 1 to 5 of 5

Run macro when opening workbook

  1. #1
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349

    Run macro when opening workbook

    I need the cursor to be in a specific cell when opening the workbook. Easily done whith a small macro, but I'd prefer not to have any pushbuttons; just go to the cell when the workbook is opened.
    I guess it is peace of cake for most of you, but I can't find anything usefull about automatic macros in the help text.

    By the way, when talking macros and VB and Excel - what is the definition of workbook? worksheet? file? spreadsheet?

  2. #2
    Forum Contributor
    Join Date
    02-15-2005
    Location
    Blackpool, UK
    Posts
    137
    Hi,

    If you call your macro "Auto_Open()" that should do the trick, although I beleive you should use "Workbook_Open()" as described here: http://www.cpearson.com/excel/events.htm.

    I treat workbook = (excel) file and worksheet = spreadsheet, although this is a simplistic view. Workbook and Worksheet as collections of which the (excel) file and spreadsheet are possible members.

    HTH

    Art

  3. #3
    Stefi
    Guest

    RE: Run macro when opening workbook

    Private Sub Workbook_Open()
    Range("A1").Select
    End Sub

    Replace A1 as needed!

    To create Sub Workbook_Open():
    Tools->Macros->Visual Basic
    Right click on Thisworkbook in your VBAProject (yourworkbookname)-> View code
    In the left dropdown list select Workbook
    The frame
    Private Sub Workbook_Open()

    End Sub
    automatically appears.

    Regards,
    Stefi


    In th


    „nsv” ezt *rta:

    >
    > I need the cursor to be in a specific cell when opening the workbook.
    > Easily done whith a small macro, but I'd prefer not to have any
    > pushbuttons; just go to the cell when the workbook is opened.
    > I guess it is peace of cake for most of you, but I can't find anything
    > usefull about automatic macros in the help text.
    >
    > By the way, when talking macros and VB and Excel - what is the
    > definition of workbook? worksheet? file? spreadsheet?
    >
    >
    > --
    > nsv
    > ------------------------------------------------------------------------
    > nsv's Profile: http://www.excelforum.com/member.php...o&userid=26500
    > View this thread: http://www.excelforum.com/showthread...hreadid=402070
    >
    >


  4. #4
    R.VENKATARAMAN
    Guest

    Re: Run macro when opening workbook

    this is possible perhaps if you create an event macro for < thisworkbook.>
    open vb editor (alt+F11)
    hit control+r(if the vb project window is not opern)
    click the particular workbook or file
    right click <thisworkbook>
    click view code

    introduce this macro
    =========
    Private Sub Workbook_Open()
    Range("a1").Select
    End Sub
    ===================
    save the workbook.

    everytime you open this workbook A1 will be highlighted.


    --
    remove $$$ from email addresss to send email




    "nsv" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I need the cursor to be in a specific cell when opening the workbook.
    > Easily done whith a small macro, but I'd prefer not to have any
    > pushbuttons; just go to the cell when the workbook is opened.
    > I guess it is peace of cake for most of you, but I can't find anything
    > usefull about automatic macros in the help text.
    >
    > By the way, when talking macros and VB and Excel - what is the
    > definition of workbook? worksheet? file? spreadsheet?
    >
    >
    > --
    > nsv
    > ------------------------------------------------------------------------
    > nsv's Profile:

    http://www.excelforum.com/member.php...o&userid=26500
    > View this thread: http://www.excelforum.com/showthread...hreadid=402070
    >




  5. #5
    Forum Contributor
    Join Date
    08-22-2005
    Location
    Denmark
    MS-Off Ver
    Excel 365
    Posts
    349
    I found out that it is quite important to put it in "Thisworkbook" and not in "Sheet 1", but now it works - so - thanks a lot all of you!!

    NSV

+ 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