How to run a macro in a different macro?

smerrick

Active Member
Joined
Feb 10, 2009
Messages
255
Hello,

Thanks for reading.

I can record simple macros using shapes. For example, I will paste in a shape, assign macro and then record away. However, there are instances whereby I have created more than 1 separate macros but I cannot seem to link them into one main macro.

As a simple demo, I have 2 separate macros, shown below. My question is, how can I modify Sub Oval4_Click() so that once it has performed its own macro that straight after it it will also work on Sub Oval5_Click()? At the moment I use 2 shapes but want to cut this down to just one.


Sub Oval4_Click()
'
' Oval4_Click Macro
'
Range("G40").Select
ActiveCell.FormulaR1C1 = "1"
Range("G41").Select
End Sub

Sub Oval5_Click()
'
' Oval5_Click Macro'
Range("G46").Select
ActiveCell.FormulaR1C1 = "2"
Range("G47").Select
End Sub
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Are both macros working on the same sheet?
 
Upvote 0
Are both macros working on the same sheet?


Hello, Yes the macros are in the same sheet. I think I have found the solution mind, all I needed to do was to add the line:

Run "Macro name"

And this has done the trick. Appreciate you reading my post - thank you.
 
Upvote 0
Glad you were able to sort it & thanks for the feedback
 
Upvote 0
crystalneed... Thank you, that is new to me. Is there an advantage to Applicaiton.Run over call?

You are quite welcome. I get so much assistance from the community, I like to contribute whenever possible.
But I don't think there are any additional advantages of one over the other. I just threw it in as an option.

Happy Rubber Ducking
Crystal
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top