One Button To Execute Two Macros [Solved/Closed]

Report
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011
-
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011
-
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

Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
791
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
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2942 users have said thank you to us this month

Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011

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.
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
791
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.
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011

Solved,Thank you very much.