Using an ActiveX button to call a macro determined by a cell reference

Johnny_H

New Member
Joined
Jan 23, 2014
Messages
12
Hi all,

I'm trying to use an activex button to activate a macro defined in a different cell....

Below, the macro name is defined in cells A1,A2 and A3,
Command buttons are then inserted and required to run the macro defined in column A.

A B
1 Macro1 "Activex button"
2 Macro2 "Activex button"
3 Macro1 "Activex button"

Is it possible to call a cell reference in the "view code" option from the command button?

Any help would be much appreciated!

Cheers,

Jon
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
try the below

Sub hello()
MsgBox "hello"
End Sub


Sub asdsa()
susbasd = Sheets("Sheet1").Range("a1").Value
If susbasd = "hello" Then
Call hello
End If
End Sub
 
Upvote 0
Try:

i.e for the first button

Code:
Application.Run (Range("A1").Value)

the second button would then have:

Code:
Application.Run (Range("A2").Value)
 
Upvote 0

Forum statistics

Threads
1,215,340
Messages
6,124,386
Members
449,155
Latest member
ravioli44

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