Running multiple macros with one command button on userform

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
583
Hi, I'm trying to run the following macros from a userform but continues to get an error each time I try:

Private Sub CommandButton1_click()
Call Worksheets("Sheet1").CommandButton11_click
Call Worksheets("Sheet1").CommandButton12_click
Call Worksheets("Sheet1").CommandButton13_click
Call Worksheets("Sheet1").CommandButton14_click

End Sub

The error received is:

Run-time error '438'
Object doesn't support this property or method

Thanks for your help.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You haven't removed the word Private from the procedure name. This
Code:
Private Sub CommandButton11_Click()
should be
Code:
Sub CommandButton11_Click()
 
Upvote 1
All those Private Sheet scripts change them to Public like this:
Code:
Public Sub CommandButton1_Click()
MsgBox "Hello"
End Sub
 
Upvote 0
Are those commandbuttons on a sheet called sheet1?
And are they ActiveX command buttons?
 
Last edited:
Upvote 0
In that case as long as your removed the "Private" from the start of the procedure names. Your code should work.
 
Upvote 0
Show us the actual scripts. There may be something wrong with the scripts.
 
Upvote 0
This is the code I'm using...

Public Sub CommandButton1_Click()

Call Sheets("Sheet1").CommandButton11_Click 'Macro1
Call Sheets("Sheet1").CommandButton12_Click 'Macro2
Call Sheets("Sheet1").CommandButton13_Click 'Macro3
Call Sheets("Sheet1").CommandButton14_Click 'Macro4

End Sub
 
Upvote 0
I want to see the code in the Button.

The button must have some code in it.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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