Run Macro on Open?

Tyler Durden

New Member
Joined
Apr 23, 2002
Messages
17
I don't know much about Visual Basic...but is there a way to make one of my Macros run when the file is opened?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
not really

try

Sub Auto_Open()

you code

End Sub

need to assign this to mudule, open excle click yes to macro warning and you code will run

HTH
 
Upvote 0
You can also place the code in the ThisWorkbook module. Right click on the Excel icon to the left of the file name in the title bar and choose view code. Change general to WorkBook. The open event is the default routine
 
Upvote 0
On 2002-04-24 14:57, Jack in the UK wrote:
Hi Lenze

i use Auto_Open(0

much any diffeernce???

just intrested old habbit i guess..
:eek:

:confused:

A workbook opened via code with the Auto_Open
code in it will NOT run the Auto open code
unless explicitly called.

Private Sub Workbook_Open()
AFIK you cannot disable via code from another workbook (except through Enableevents)ie.
Opening a workbook via code with Auto open
you can disable the running of the Auto open.
Openning a workbook via code that has
Private Sub Workbook_Open() you cannot
(Except through Disable events)

The Diff are subtle but you can use this
to your advantage.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top