Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic links message when opening a workbook pgarcia Excel Discussion (Misc queries) 2 March 8th 07 10:53 PM
Opening Workbook resets calculation to automatic from manual etc Bill Shepherd Excel Discussion (Misc queries) 2 May 31st 06 02:02 PM
Disable VBA code execution when loading a workbook Charles Excel Discussion (Misc queries) 4 October 14th 05 09:12 PM
Execution on opening the workbook. Hari[_3_] Excel Programming 3 June 1st 04 01:47 AM
Automatic update of code in other workbook Tony C[_2_] Excel Programming 2 February 17th 04 12:34 PM


All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"