Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VBA to assign a macro to button
I've searched through several posts but can't find a solution that helps me.
Here is what I am trying to do: I have a button with an attached macro that imports a data table from a sheet for the user to edit. When the user is done he must select a save button, which is attached to a macro that copies the data table back to its original place with the new data. All works well to this point. However, There are many data tables that need to be brought in by means of macro attached buttons. Once the user is done, each needs to be saved back to its original location when the user selects the save button. This means that the save button needs to be assigned a new save macro when each new table is brought in. The save button's name is Chevron 41. So if I bring in TABLE_A I need to be able to add a line of code to its macro that sets button Chevron 41 to use macro SAVE_TABLE_A. If I bring in TABLE_B I need to be able to add a line of code to its macro that sets button Chevron 41 to use macro SAVE_TABLE_B. Etc. Here is the code that does not work: ' [NOW ASSIGN A SAVE MACRO TO THE SAVE BUTTON] Application.CutCopyMode = False ' Selection.OnAction = "SAVE_TABLE_A_Save" <<< This produces a debug error message so I tried this..... ActiveSheet.Shapes("Chevron_41").OnAction = "SAVE_TABLE_A_Save" Range("A11").Select <<< This produces a message that says item with name was not found. Any help would be appreciated. GBExcel -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VBA to assign a macro to button
I think I've found the answer. I needed to use a control button rather than a
shape button. The control works. GBExcel -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200912/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to assign a macro to a button | Excel Programming | |||
How do I Assign Macro to a button? | Charts and Charting in Excel | |||
Assign macro to button | Excel Programming | |||
Assign macro to button | Excel Programming | |||
Assign button to run macro | Excel Programming |