ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to change Button Macro assignment (https://www.excelbanter.com/excel-programming/336571-vba-change-button-macro-assignment.html)

Ken Loomis

VBA to change Button Macro assignment
 
I would like to change or remove a macro assignment to buttons.

I use this to change the text of a shape that I use as a button:

ActiveSheet.Shapes("Rectangle 5").Select
Selection.Characters.Text = "Mark Anomolies"

How would I change or remove the macro assignment to that button?

TIA,
Ken



Norman Jones

VBA to change Button Macro assignment
 
Hi Ken,

To change assignment, try:

ActiveSheet.Shapes("Rectangle 5")..OnAction = "MyNewMacro"


To Remove the assignment:

ActiveSheet.Shapes("Rectangle 5")..OnAction = ""


---
Regards,
Norman



"Ken Loomis" wrote in message
...
I would like to change or remove a macro assignment to buttons.

I use this to change the text of a shape that I use as a button:

ActiveSheet.Shapes("Rectangle 5").Select
Selection.Characters.Text = "Mark Anomolies"

How would I change or remove the macro assignment to that button?

TIA,
Ken





L. Howard Kittle

VBA to change Button Macro assignment
 
Hi Ken,

Try something like this.

To remove only:
ActiveSheet.Shapes("Rectangle 5").OnAction = ""

To change:
ActiveSheet.Shapes("Rectangle 5").OnAction = "New Macro Name"

HTH
Regards,
Howard

"Ken Loomis" wrote in message
...
I would like to change or remove a macro assignment to buttons.

I use this to change the text of a shape that I use as a button:

ActiveSheet.Shapes("Rectangle 5").Select
Selection.Characters.Text = "Mark Anomolies"

How would I change or remove the macro assignment to that button?

TIA,
Ken






All times are GMT +1. The time now is 01:25 PM.

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