ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   error in code when placed in workbook_open (https://www.excelbanter.com/excel-programming/370071-error-code-when-placed-workbook_open.html)

Corey

error in code when placed in workbook_open
 
Sub Workbook_Open()
Worksheets("Sheet2").Select
Call Macro1
End Sub

I am getting an error of:

'Compile error:

Sub or Function not defined'




Yet if i manually run the macro it works fine??


Corey....

NickHK

error in code when placed in workbook_open
 
Corey,
Where is "macro1" ? Public in a normal module ?

NickHK


"Corey" wrote in message
...
Sub Workbook_Open()
Worksheets("Sheet2").Select
Call Macro1
End Sub

I am getting an error of:

'Compile error:

Sub or Function not defined'




Yet if i manually run the macro it works fine??


Corey....



Norman Jones

error in code when placed in workbook_open
 
Hi Corey,

Where is Macro1 housed?


---
Regards,
Norman


"Corey" wrote in message
...
Sub Workbook_Open()
Worksheets("Sheet2").Select
Call Macro1
End Sub

I am getting an error of:

'Compile error:

Sub or Function not defined'




Yet if i manually run the macro it works fine??


Corey....



Corey

error in code when placed in workbook_open
 
Macro1 is in the code for the Thisworkbook

Is'nt that were anything to run when opening is to be placed?

ctm

"NickHK" wrote in message
...
Corey,
Where is "macro1" ? Public in a normal module ?

NickHK


"Corey" wrote in message
...
Sub Workbook_Open()
Worksheets("Sheet2").Select
Call Macro1
End Sub

I am getting an error of:

'Compile error:

Sub or Function not defined'




Yet if i manually run the macro it works fine??


Corey....





Corey

error in code when placed in workbook_open
 
Sorry i made a mistake.
Macro1 is in the code for Sheet2.

AHHH

Thanks for the pointer.
I moved it to a Module and it now is fine.

Thanks
Corey....



....
"NickHK" wrote in message
...
Corey,
Where is "macro1" ? Public in a normal module ?

NickHK


"Corey" wrote in message
...
Sub Workbook_Open()
Worksheets("Sheet2").Select
Call Macro1
End Sub

I am getting an error of:

'Compile error:

Sub or Function not defined'




Yet if i manually run the macro it works fine??


Corey....






All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com