View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default 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.