Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
where put code for automatic execution upon opening workbook?
Thanks for any help.
I have a workbook with a couple worksheets, and upon opening, I want the active cell to always be A1 for each worksheet, and the active worksheet to be the first one. The way I do that now is, after I do modifications, I click A1 and save with the first workbook activated. But this is a hassle to do everytime. I forgot where to put code that always executes when the workbook is open. Where do I put it, or how do I label it? Thanks very much. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
where put code for automatic execution upon opening workbook?
Hi Ian,
Try pasting the following code into the workbook's This Workbook module. Sub workbook_Open() Dim sh As Worksheet Dim i As Long Application.ScreenUpdating = False For i = Me.Worksheets.Count To 1 Step -1 Worksheets(i).Activate Range("A1").Select Next Application.ScreenUpdating = True End Sub To get to the ThisWorkbook module, right-click the Excel icon right-click the Excel icon on the worksheet (or to the left of the File menu if the workbook is maximised), select View Code from the menu, and paste the code --- Regards, Norman "Ian Elliott" wrote in message ... Thanks for any help. I have a workbook with a couple worksheets, and upon opening, I want the active cell to always be A1 for each worksheet, and the active worksheet to be the first one. The way I do that now is, after I do modifications, I click A1 and save with the first workbook activated. But this is a hassle to do everytime. I forgot where to put code that always executes when the workbook is open. Where do I put it, or how do I label it? Thanks very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatic links message when opening a workbook | Excel Discussion (Misc queries) | |||
Opening Workbook resets calculation to automatic from manual etc | Excel Discussion (Misc queries) | |||
Disable VBA code execution when loading a workbook | Excel Discussion (Misc queries) | |||
Execution on opening the workbook. | Excel Programming | |||
Automatic update of code in other workbook | Excel Programming |