Automatic cursor position?

M

Mark

Is there a way to set the cursor to automatically go to a
specific "home" everytime a specific workbook/worksheet is
open? I would like to have the ability to set the cursor
to always go to one cell whenever the file is open (NOT to
where it was last left when the file was last closed).
 
R

Ron de Bruin

You can use this in the Thisworkbook module

Right click on the Excel icon next to File in the menubar
choose view code
paste it in there
Alt-Q to go back to Excel


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.Goto Reference:=Worksheets("Sheet1").Range("A1"), _
scroll:=True
End Sub
 
R

Ron de Bruin

Better use this event instead of the BeforeSave Mark

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Goto Reference:=Worksheets("Sheet1").Range("A1"), _
scroll:=True
End Sub
 

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