Auto GoTo

jade423

New Member
Joined
May 29, 2008
Messages
26
Upon closing any excel workbook in a specific folder, I want it to GoTo Sheet1 A1 prior to saving, so that when the next person opens up any given .xls they will be on the first page. Is that a possibility?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Right click the Excel logo just to the left of File on the menu bar, select View Code and paste in

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Goto reference:=Sheets("Sheet1").Range("A1"), scroll:=True
End Sub
 
Upvote 0
Yes, this is possible using the Workbook BeforeClose event. However, in order for this to work the workbook would have to be saved (and the user may not want to save changes).

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Sheet1").Activate
Range("A1").Select
ThisWorkbook.Save
End Sub

That's about the simplest form - you may want to have a message box to confirm that the user wants to save?
 
Upvote 0
That worked great. One problem is that if someone opens up the .xls and does not change anything, but travels to another page, it doesnt save the file, so therefore it doesnt save the GoTo jump... Any ideas?
 
Upvote 0
If a user opens a file but doesn't save then the next person who opens it will see the tab that was active when the file was last saved. So it doesn't matter if they go to a different tab if they don't save.

You could force Excel to go to Sheet1 A1 on every save, though the end users may find this a little disruptive!

I would suggest having Sheet1 activated when the workbook is opened - that way you get what you want without any downside.
 
Upvote 0
Try doing this when the workbook is opened

Code:
Private Sub Workbook_Open()
Application.Goto reference:=Sheets("Sheet1").Range("A1"), scroll:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top