Move to Cell A1 When Opening or Activating an Excel Worksheet
Question details
Select cell A1 automatically when an Excel workbook opens or a worksheet is activated.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A workbook contains multiple worksheets, and the user wants each worksheet to return to A1 when selected.
- Observed behavior
- The active worksheet starts at A1 when the workbook opens, and each worksheet selects A1 when activated.
Open the workbook in desktop Excel and check that macros are permitted by your organization's security settings. The shortcut Alt+F11 opens the Visual Basic Editor in Excel for Windows.
Use workbook events to select A1 automatically
Add VBA to ThisWorkbook so A1 is selected both on opening the workbook and when activating a worksheet.
In desktop Excel, open the workbook and press Alt+F11 on Windows. If Project Explorer is not visible, choose View > Project Explorer.
In Project Explorer, expand your workbook's VBA project and double-click ThisWorkbook.
Paste the following code into the ThisWorkbook editor: Private Sub Workbook_Open() If TypeOf ActiveSheet Is Worksheet Then ActiveSheet.Range("A1").Select End If End Sub Private Sub Workbook_SheetActivate(ByVal Sh As Object) If TypeOf Sh Is Worksheet Then Sh.Range("A1").Select End If End Sub
Return to Excel and choose File > Save As. Select Excel Macro-Enabled Workbook (*.xlsm) as the file type, then save.
Close and reopen the workbook. If prompted and you trust the file, select Enable Content. Switch between worksheets using their sheet tabs and confirm that A1 is selected.

Work with spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move existing files into your workflow. Excel VBA event behavior is not guaranteed in WPS.

Frequently Asked Questions
Why do I need both Workbook_Open and Workbook_SheetActivate?
Workbook_Open selects A1 on the active worksheet when the workbook opens. Workbook_SheetActivate selects A1 whenever you switch to a worksheet using its tab.
Why does the code have to be in ThisWorkbook?
These are workbook event procedures. In the Visual Basic Editor, open the workbook's project in Project Explorer and place them in ThisWorkbook so Excel can respond to those events.
Why does the macro stop working after I save the workbook?
VBA code must be saved in a macro-enabled format. Choose File > Save As and select Excel Macro-Enabled Workbook (*.xlsm). When reopening a trusted file, enable content if prompted.
Will this VBA run in Excel for the web?
No. Excel for the web does not run VBA macros. Open the workbook in desktop Excel to run the workbook events.




