|
|
|
|
|
|
Excel
|
Ensure that cell A1 on a specific sheet is selected when workbook is opened
|
|
Ease of Use
|
Easy
|
Version tested with
|
2003
|
Submitted by:
|
Ken Puls
|
Description:
|
This macro automatically activates the specified sheet and selects cell A1 whenever the workbook is opened. It can also VERY easily be updated to be a different range.
|
Discussion:
|
Sometimes you may want to ensure that your users always open your workbook at a specific cell in a specific sheet. This code will allow you to do that. By default, this code selects cell A1 on a worksheet called "Home".
|
Code:
|
instructions for use
|
Option Explicit
Private Sub Workbook_Open()
With Worksheets("Home")
.Activate
.Range("A1").Select
End With
End Sub
|
How to use:
|
- Copy above code.
- In Excel press Alt + F11 to enter the VBE.
- Press Ctrl + R to show the Project Explorer.
- Locate the desired file on left (in bold).
- Drill down (if necessary) until you find the file's ThisWorkbook object (in the Microsoft Excel Objects folder).
- Double Click the ThisWorkbook object.
- Paste code into the right pane.
- Press Alt + Q to close the VBE.
- Save workbook before any other changes.
|
Test the code:
|
- Make sure you select any cell other than A1 (or whichever you specified), or are on a different sheet
- Save and close the workbook
- Open the workbook and confirm that you are now in cell A1 on the sheet you specified in the code
|
Sample File:
|
GoHome.zip 6.33KB
|
Approved by mdmackillop
|
This entry has been viewed 157 times.
|
|