This post demonstrates how to automatically select cell A1 on each sheet in a workbook before you close a workbook. The vba code also makes cell A1 the upper left cell on all sheets.

VBA code

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet, csheet As Worksheet
Application.ScreenUpdating = False
Set csheet = ActiveSheet
For Each sht In ActiveWorkbook.Worksheets
  If sht.Visible Then
    ActiveWindow.ScrollRow = 1
    ActiveWindow.ScrollColumn = 1
  End If
Next sht
Application.ScreenUpdating = True
End Sub

Where to copy the code

  1. Press Alt-F11 to open visual basic editor
  2. Double click ThisWorkbook in project explorer.
    Ctrl + R opens project explorer.
  3. Copy and paste above vba code.
  4. Exit visual basic editor

Download excel file

Reset selection to A1.xlsm
Excel 2007 Macro-Enabled Workbook *.xlsm