Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 231
Default Control button / macro

Hi there,
I have a control button on a spreadsheet. And I have a macro already
written. How do I attach that macro to the button without having to write or
copy the macro code into the control code? I'm really bad at writing that
stuff and I think I am messing up the syntax so wondered if there was an
easier way.
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default Control button / macro

Le'ts assume your macro is named "myFavoriteMacro" and you want to do
things very, very simply.
On your worksheet, double-click the control button. This will pop-up
the VBE environment with some code pointing to your command button. It
will look something like:
Private Sub CommandButton1_Click()

End Sub
All you need to do is put in the line "Call myFavoriteMacro" before
the "End Sub" and you're there.

HTH
/ Tyla /

On Feb 10, 5:57 pm, Sarah wrote:
Hi there,
I have a control button on a spreadsheet. And I have a macro already
written. How do I attach that macro to the button without having to write or
copy the macro code into the control code? I'm really bad at writing that
stuff and I think I am messing up the syntax so wondered if there was an
easier way.
Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Control button / macro

You could, as a possible alternative, create your button from the Forms toolbar.

Right-click and "assign macro".

Select your macro by name and OK.


Gord Dibben MS Excel MVP

On Sat, 10 Feb 2007 17:57:00 -0800, Sarah
wrote:

Hi there,
I have a control button on a spreadsheet. And I have a macro already
written. How do I attach that macro to the button without having to write or
copy the macro code into the control code? I'm really bad at writing that
stuff and I think I am messing up the syntax so wondered if there was an
easier way.
Thanks!


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
Macro Help (Uppercase multiple ranges?) Ken Excel Discussion (Misc queries) 14 December 2nd 06 07:23 PM
Macro Assigned to a Button zephyr Excel Discussion (Misc queries) 1 October 25th 06 03:33 PM
Macro button on toolbar Lesley Excel Discussion (Misc queries) 2 August 28th 06 07:32 PM
Assigning macro to button d Excel Discussion (Misc queries) 0 August 22nd 05 01:40 PM
assign a macro to a control button ewan72 Excel Discussion (Misc queries) 1 December 3rd 04 02:04 PM


All times are GMT +1. The time now is 08:46 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"