|
|

Introduction to Simple VBA macros:
Automatically display a specific Excel sheet
When you save a workbook, Excel maintains which
worksheet and cell has focus at the time so that the next time you
open the file you're returned to the same place. However, you may
prefer that Excel consistently displays the same sheet when you open
the file, such as when a worksheet acts as a table of contents for
the workbook. You can force Excel to display your desired sheet
using VBA. To do so, press [Alt][F11] to display the VB Editor. In
the Project Explorer, if necessary, expand the tree views for your
workbook and Microsoft Excel Objects. Then, double-click the This
Workbook icon that appears beneath your workbook's name. Next,
select Workbook from the Object dropdown list and Open from the
Procedure dropdown list. At the insertion point, enter:
Worksheets("Sheet1").Select
Finally, press [Alt][F11] again to return to
Excel and save the file. This procedure will display Sheet1 in the
workbook any time the file is opened. You can substitute the name
found on any worksheet tab if you'd rather open to another sheet.
|
|