View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do you do the following using VBA macro automatically?

Excel has no AUTO_RUN function.

Did you mean Auto_Open?

I would put this code into Thisworkbook Module.

Private Sub Workbook_Open()
Application.Calculate
With ThisWorkbook
.Save
.Close
End With
End Sub

But note...............you will have to disable events if you ever want to
keep the workbook open for editing.


Gord Dibben MS Excel MVP

On Tue, 4 May 2010 12:13:34 -0700 (PDT), LunaMoon
wrote:

Hi all,

I would like to have the following run every time when the Excel 2003
sheet is opened:

so I am going to put the VBA macro into AUTO_RUN function...

Now when the Excel 2003 file is opened,

I need the following:

1. refresh/recalculate all the sheets in the Excel 2003 file;
2. save all the sheets;
3. close out the file.

Please help me translate these into VBA/MACRO... thanks a lot!