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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
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
Got it, here you go....thanks for your help.

Private Sub CommandButton11_Click()
If Range("os56") = 0 Then
Range("AA81:AA81").Select
Range("AA81:AA81").Activate
Selection.RowHeight = 0.000001
Range("AA82:AA82").Select
Range("AA82:AA82").Activate
Selection.RowHeight = 0.000001
Range("AA83:AA83").Select
Range("AA83:AA83").Activate
Selection.RowHeight = 0.000001

Range("os56") = 4
Else
Range("AA81:AA81").Select
Range("AA81:AA81").Activate
Selection.RowHeight = 12.75
Range("AA82:AA82").Select
Range("AA82:AA82").Activate
Selection.RowHeight = 12.75
Range("AA83:AA83").Select
Range("AA83:AA83").Activate
Selection.RowHeight = 13.5

Range("os56") = 0
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

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