![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com