ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do you call one Sub from another Sub ? (https://www.excelbanter.com/excel-programming/279852-how-do-you-call-one-sub-another-sub.html)

lothario[_30_]

How do you call one Sub from another Sub ?
 
Hi,

I have some VBA code attached to a button in sheet3.
I would like to use the exact same code in 6 other sheets.
How do I call this Sub in sheet3 from the other sheets?

Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Ron de Bruin

How do you call one Sub from another Sub ?
 
One way is to place the code in a macro and place the macro in
a normal module

Usethe macro name in the click event of the button like this

Private Sub CommandButton1_Click()
subname
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"lothario" wrote in message ...
Hi,

I have some VBA code attached to a button in sheet3.
I would like to use the exact same code in 6 other sheets.
How do I call this Sub in sheet3 from the other sheets?

Thanks,
Luther



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




lothario[_31_]

How do you call one Sub from another Sub ?
 
Thanks Ron.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 12:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com