Write a macro that would "click" a command button i.e. another macro

lilbusgirl

New Member
Joined
Jan 29, 2014
Messages
5
Hi I am trying to write a macro that would "click" a command button that is in another tab contained within the workbook. Would that be possible? Without changing any of the code within the other tabs?

I don't have access to the other macro as it was developed by another software person.

I have 6 workbooks with approx 60tabs in each one and I didn't want to go into each tab and press the command button 'calculate' each time. I wanted to streamline it with having one macro which I named 'compute all' to do it for me.

The code that's been written only recognises the cell (H38) behind the calculate button, so you get the picture, the sheets ("0.5RC 0.5LC") are one of the 60 tabs within the workbook.

Sub Macro5()
'
' Macro5 Macro
' Run all scenarios at once
'
' Keyboard Shortcut: Ctrl+q

Sheets("0.5RC 0.5LG").Select
Range("H38").Select
Sheets("0.5RC 1.5LG").Select
Range("H38").Select
Sheets("0.5RC 2LG").Select
Range("H38").Select
Sheets("0.5RC 2.5LG").Select
Range("H38").Select
Sheets("0.5RC 3.5LG").Select
Range("H38").Select
Sheets("0.5RC 4LG").Select
Range("H38").Select

I have looked into using below but this doesn't work as I don't want to have to change the name of the excel spreadsheet each time. Sub Run_Macro()

Workbooks.Open Filename:="C:\Book1.xls"
'Open the workbook containing the command button
'Change the path and filename as required

Application.Run "Book1.xls!Macro1"
'Run the macro
'Change the filename and macro name as required

'If the macro is attached to a worksheet rather than a module, the code would be
'Application.Run "Book1.xls!Sheet1.Macro1"

Help been googling solutions but nothing is remotely close to what I want to do.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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