View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
papou papou is offline
external usenet poster
 
Posts: 110
Default Command Button for Macro on a Toolbar

Hello
1- Record your macro, when finished, right-click on your command button,
select view code and just enter your macro name under Private Sub
CommandButton1_Click().
eg:
Private Sub CommandButton1_Click()
MacroNameHere
End Sub

2- Command buttons are objects related to sheets and therefore cannot be
placed into the Excel toolbar.
If your wish is to execute some code when clicking on a button from the
toolbar, you may consider building a custom commandbar button and assign a
macro to it.

HTH
Cordially
Pascal


"Office Junior" a écrit dans le
message de news: ...
Hi fellow Excel Users
I have a couple of questions

I know how to create a command button using The Control Toolbox

1. How do I record a macro and assign it to this command button
2. How do I get the command button to sit on my toolbar.

Many thanks in advance