ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Running macro on file open (https://www.excelbanter.com/excel-discussion-misc-queries/179823-running-macro-file-open.html)

excelnerd

Running macro on file open
 
When I open a particular excel file, I want to always have the cursor on a
specific worksheet. That is, I want the file to open in a particular
worksheet. How can I do that?

Many thanks in advance.

Dave Peterson

Running macro on file open
 
You could use a macro:

Option Explicit
Sub Auto_Open()
application.goto thisworkbook.worksheets("sheet9999").range("a1"), _
scroll:=true
End Sub

Change the sheet name and cell address to what you want.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

excelnerd wrote:

When I open a particular excel file, I want to always have the cursor on a
specific worksheet. That is, I want the file to open in a particular
worksheet. How can I do that?

Many thanks in advance.


--

Dave Peterson

Billy Liddel

Running macro on file open
 
Private sub workbook_open()
application.goto sheets("Sheet1").range("a1")
exit sub

placed in the workbook module, Right-click the Excel icon by the file menu
and choose View code.

Peter

excelnerd

Running macro on file open
 
Thank you very much. It was really helpful.

"Dave Peterson" wrote:

You could use a macro:

Option Explicit
Sub Auto_Open()
application.goto thisworkbook.worksheets("sheet9999").range("a1"), _
scroll:=true
End Sub

Change the sheet name and cell address to what you want.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

excelnerd wrote:

When I open a particular excel file, I want to always have the cursor on a
specific worksheet. That is, I want the file to open in a particular
worksheet. How can I do that?

Many thanks in advance.


--

Dave Peterson



All times are GMT +1. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com