Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Code for Buttons

I have a simple copy and paste macro which pulls from a
range in one workbook to another. How can I assign that
macro to a command button (from forms)? It can't be a menu
button becuase I will have too many. Does the button call
the macro or do I need additional code (under view code).
I tried to copy my macro code but didn't work.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code for Buttons

put the button on the sheet (from the forms toolbar), right click on it and
select assign macro. Actually, when you draw the button on the sheet, you
should get prompted with a dialog to assign a macro.

Once assigned, when you press the button, the button fires the macro.

--
Regards,
Tom Ogilvy

Mike wrote in message
...
I have a simple copy and paste macro which pulls from a
range in one workbook to another. How can I assign that
macro to a command button (from forms)? It can't be a menu
button becuase I will have too many. Does the button call
the macro or do I need additional code (under view code).
I tried to copy my macro code but didn't work.

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Code for Buttons (Hey, Tom)

Thanks, Tom, however it's not working like that for me. I
have Office XP and when I create a button it does not ask
to assign macro nor does it have "assign macro" when right
clicked. I have view code which opens a blank VBA space
for me to author a routine for the button (onclick).
Help also indicates to use View Code.

How should I approach this?

Mike


-----Original Message-----
put the button on the sheet (from the forms toolbar),

right click on it and
select assign macro. Actually, when you draw the button

on the sheet, you
should get prompted with a dialog to assign a macro.

Once assigned, when you press the button, the button

fires the macro.

--
Regards,
Tom Ogilvy

Mike wrote in message
...
I have a simple copy and paste macro which pulls from a
range in one workbook to another. How can I assign that
macro to a command button (from forms)? It can't be a

menu
button becuase I will have too many. Does the button

call
the macro or do I need additional code (under view

code).
I tried to copy my macro code but didn't work.

Thanks.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Code for Buttons (Hey, Tom)

I'm not Tom, but that sure sounds like you used the commandbutton from the
Controltoolbox toolbar (not the Forms toolbar).

I'd double check one more time.


Mike wrote:

Thanks, Tom, however it's not working like that for me. I
have Office XP and when I create a button it does not ask
to assign macro nor does it have "assign macro" when right
clicked. I have view code which opens a blank VBA space
for me to author a routine for the button (onclick).
Help also indicates to use View Code.

How should I approach this?

Mike

-----Original Message-----
put the button on the sheet (from the forms toolbar),

right click on it and
select assign macro. Actually, when you draw the button

on the sheet, you
should get prompted with a dialog to assign a macro.

Once assigned, when you press the button, the button

fires the macro.

--
Regards,
Tom Ogilvy

Mike wrote in message
...
I have a simple copy and paste macro which pulls from a
range in one workbook to another. How can I assign that
macro to a command button (from forms)? It can't be a

menu
button becuase I will have too many. Does the button

call
the macro or do I need additional code (under view

code).
I tried to copy my macro code but didn't work.

Thanks.



.


--

Dave Peterson

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
Reset button code for Radio Buttons [email protected] Excel Discussion (Misc queries) 6 August 25th 12 03:09 PM
Code for Command Buttons Ayman Excel Discussion (Misc queries) 1 November 3rd 08 08:37 PM
Option Buttons/Radio Buttons John Calder New Users to Excel 7 May 16th 08 03:51 AM
Form buttons vs. ActiveX Buttons GeorgeJ Excel Discussion (Misc queries) 3 August 11th 07 09:02 PM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM


All times are GMT +1. The time now is 06:06 AM.

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"