Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Assigning a macro to a button

Hi,

I have created and tested a macro and now I want to assign it to a button in
the actual spreadsheet. How can I do this? as the only option I can find is
to copy and paste the VB code from the exisiting macro into code for the
button?

Many thanks,

Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assigning a macro to a button


Double click button to open VB Editor


Code:
--------------------

Call MacroName

--------------------


or right click the button and assign Macro to it :)


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=529150

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Assigning a macro to a button

Hello Nigel
You do not need to paste the entire code into the commandbutton.
Just call the macro from your button ie:
assuming your macro name is "MyMacro"
Private Sub CommandButton1_Click()
MyMacro
End Sub

HTH
Cordially
Pascal



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Assigning a macro to a button

Many thanks, it works a treat!!

"gti_jobert" wrote:


Double click button to open VB Editor


Code:
--------------------

Call MacroName

--------------------


or right click the button and assign Macro to it :)


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=529150


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
Assigning A Macro to A Button Holly Excel Worksheet Functions 1 January 18th 08 10:04 AM
assigning a macro to a button Darby Excel Discussion (Misc queries) 2 February 10th 06 05:05 PM
assigning macro to button BorisS Excel Discussion (Misc queries) 2 September 12th 05 05:08 AM
Assigning macro to button d Excel Discussion (Misc queries) 0 August 22nd 05 01:40 PM
Assigning a macro to a button Junkyard Engineer Excel Programming 3 June 9th 05 02:00 PM


All times are GMT +1. The time now is 07:05 PM.

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

About Us

"It's about Microsoft Excel"