Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to assign a macro to a button WANNABE Excel Programming 2 October 2nd 06 08:25 PM
How do I Assign Macro to a button? BellExcel Charts and Charting in Excel 4 May 20th 05 07:21 PM
Assign macro to button Bob Phillips[_6_] Excel Programming 0 May 24th 04 04:27 PM
Assign macro to button Frank Kabel Excel Programming 0 May 24th 04 04:03 PM
Assign button to run macro jamie85[_5_] Excel Programming 8 February 3rd 04 01:44 PM


All times are GMT +1. The time now is 04:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"