MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Auto starting an Excel macro - Help!


Posted by adrian N on December 17, 2001 5:40 PM

I can't auto run my macro when the sheet is loaded.
I have tried...
Sub Auto_Open()
'This lives in Module1
Call Initialise
End Sub

Private Sub workbook_open()
'This lives in This WorkBook
Call Initialise
End Sub

Both these methods generate the same "Compile Error"...
"Sub or Function not defined"

My spreadsheet only has one Sheet called "Roster", which is where my macro code resides.
To get it working, I have placed a button on the sheet to manually get the macro running.


Posted by Qroozn on December 17, 2001 5:51 PM

spelling

check you spelling of initialise.
make sure the macro is actually named the same a s your call routine. i bet this is the problem.

Posted by DaK on December 17, 2001 5:55 PM

Try placing the code on the worksheet.
Use:
Private sub Worksheet_Activate()
Initialise
end sub

Place sub initialise in a module and make it public.

I think that might work for you.

DaK