![]() |
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? -- nsv ------------------------------------------------------------------------ nsv's Profile: http://www.excelforum.com/member.php...o&userid=26500 View this thread: http://www.excelforum.com/showthread...hreadid=402070 |
Hi, If you call your macro "Auto_Open()" that should do the trick, although I beleive you should use "Workbook_Open()" as described he 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 -- HiArt ------------------------------------------------------------------------ HiArt's Profile: http://www.excelforum.com/member.php...o&userid=19953 View this thread: http://www.excelforum.com/showthread...hreadid=402070 |
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" wrote in message ... 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 |
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 |
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 -- nsv ------------------------------------------------------------------------ nsv's Profile: http://www.excelforum.com/member.php...o&userid=26500 View this thread: http://www.excelforum.com/showthread...hreadid=402070 |
All times are GMT +1. The time now is 08:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com