Running multiple macros with one command button on userform

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
573
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.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,406
All those Private Sheet scripts change them to Public like this:
Code:
Public Sub CommandButton1_Click()
MsgBox "Hello"
End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,643
Office Version
365
Platform
Windows
Are those commandbuttons on a sheet called sheet1?
And are they ActiveX command buttons?
 
Last edited:

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
573
Fluff, that is correct.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,643
Office Version
365
Platform
Windows
In that case as long as your removed the "Private" from the start of the procedure names. Your code should work.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,406
Show us the actual scripts. There may be something wrong with the scripts.
 

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
573
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
 

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
573
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
 

Forum statistics

Threads
1,085,331
Messages
5,383,009
Members
401,811
Latest member
emelyan1379

Some videos you may like

This Week's Hot Topics

Top