ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Running a Macro from within another macro (https://www.excelbanter.com/excel-discussion-misc-queries/51930-running-macro-within-another-macro.html)

grahammal

Running a Macro from within another macro
 

Is there a way of calling a macro from within another macro?

Example

Sub Button1_Click()
For a = 1 To 10000
Range("A1") . Value = a
Next a
' Would now like to run the macro which is behind Sub
Button2_Click()
End Sub


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=478781


Peo Sjoblom

Running a Macro from within another macro
 
Yes,

put the name of the macro within your macro

Sub MyMacro1()
MyMacro2
End Sub

Regards,

Peo Sjoblom

"grahammal" wrote
in message ...

Is there a way of calling a macro from within another macro?

Example

Sub Button1_Click()
For a = 1 To 10000
Range("A1") . Value = a
Next a
' Would now like to run the macro which is behind Sub
Button2_Click()
End Sub


--
grahammal
------------------------------------------------------------------------
grahammal's Profile:

http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=478781




grahammal

Running a Macro from within another macro
 

Works perfectly.
Thanks a million.


--
grahammal
------------------------------------------------------------------------
grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336
View this thread: http://www.excelforum.com/showthread...hreadid=478781



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

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