I am having trouble re-assigning macros to buttons(shapes?) using vba.
I have tried using the following:
ActiveSheet.Shapes("Button 3").Select
Selection.OnAction = "Data_1"
ActiveSheet.Shapes("Button 1").Select
Selection.OnAction = "Data_2"
I created these buttons from the forms toolbar in excel.
Some sheets have 6 or more buttons.
This works fine on the original worksheet but when I copy that sheet to another book the names "Button 3” change e.g button 3 might become button 5.
Is there any method I can use in vba to do this.
Thanks
I have tried using the following:
ActiveSheet.Shapes("Button 3").Select
Selection.OnAction = "Data_1"
ActiveSheet.Shapes("Button 1").Select
Selection.OnAction = "Data_2"
I created these buttons from the forms toolbar in excel.
Some sheets have 6 or more buttons.
This works fine on the original worksheet but when I copy that sheet to another book the names "Button 3” change e.g button 3 might become button 5.
Is there any method I can use in vba to do this.
Thanks