Macro at Startup

JTL9161

Well-known Member
Joined
Aug 29, 2012
Messages
591
Office Version
  1. 365
Platform
  1. Windows
I have the below macro in the workbook startup to ask if I want to run the macro in the workbook.

Private Sub Workbook_Open()
CarryOn = MsgBox("Do you want to run the Macro?", vbYesNo)
If CarryOn = vbYes Then
Application.Run Macro:="holding2"
End If
End Sub

After I click "YES" it tells me the macro is not available. Its a separate module in the same spreadsheet. Is there another way to run it or do I need to move all my code over to the workbook startup and all under the msg book question code?

Thanks
James
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try using
Code:
Call holding2
 
Upvote 0
Now I do not even get the message box. I get "Expected Variable or procedure, not module" error
 
Upvote 0
What is the name of the macro you are trying to run?
 
Upvote 0
What is the first line of the sub where the name is?
 
Upvote 0
Can you please your entire "Holding2" code block?
Also, which module is this code found in?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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