One Button To Execute Two Macros

Solved/Closed
azmiismail
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011
- Mar 3, 2011 at 01:16 AM
azmiismail
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011
- Mar 3, 2011 at 11:06 PM
Hello,
I got one macro in Sheet1 and another macro in sheet2 under the same workbook.I want to assign a button in sheet1 so it can execute both the macros in sheet1 and sheet2.Can someone help me....please

Thanks
Related:

4 replies

venkat1926
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
810
Mar 3, 2011 at 04:34 AM
are they macros or event codes depending upon the sheet name. are they macros in the same workbooks create anothermacro

sub fullmacsro
(name of first macro)
(name of second macro)
end usb

make a button and assign "fullmacro" to this button.
6
azmiismail
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011

Mar 3, 2011 at 06:14 PM
Got an error message.To be more specific below are the details,

Under the workbook named "TESTCOMBUTTON"

In Sheet1,the code is,
Sub ClrClls()
Range("B2:B4").ClearContents
End Sub

In Sheet2,the code is,
Sub ClrChks()
ActiveSheet.CheckBoxes.Value=False
End Sub

I would like to assign a button in sheet1 to execute both the code.

Thanks.
0
venkat1926
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
810
Mar 3, 2011 at 08:12 PM
there is no macro in one sheet and another macro in another sheet. the macros are in one module in vb editor


anyhow try this modification


Sub ClrClls()  
worksheets("sheet1").activate  
Range("B2:B4").ClearContents  
End Sub  


Sub ClrChks()  
worksheets("sheet2").activate  
ActiveSheet.CheckBoxes.Value=False  
End Sub 



whenever you talk about error message you musts tell at which statement the error message occurs(or the macro stops) and also the text of error message which will be helpful to try to solve the problem.
0
azmiismail
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011

Mar 3, 2011 at 11:06 PM
Solved,Thank you very much.
0