Run macro when opening workbook

N

nsv

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?
 
H

HiArt

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
 
R

R.VENKATARAMAN

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.
 
G

Guest

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:
 
N

nsv

I found out that it is quite important to put it in "Thisworkbook" an
not in "Sheet 1", but now it works - so - thanks a lot all of you!!

NS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top