Assigning Macro to a Command Button

M

melaniem

I created a macro that will hide a chunk of data so that I can copy and paste
select information to send to someone.
I added a radio button or command button.

If I create a check box, I can right click and say "assign macro". When I
try to assign a command button I do not have the same option.

I tried going into the view code but I haven't got a clue what to do when
I'm there.
 
M

Mike Rogers

melaniem

Please try to be a little more clear as to what you are trying to do. I got
that you have the macro, and it sounds like you are trying to run it via a
button or something. Post back and tell us what you are trying to accomplish.

Mike Rogers
 
S

Sian

Melanie,

If you right click on the radio button do you see "Assign macro" grayed out
or is it not there at all?

If it's not there at all, in design mode you can double click on the control
and you'll bring up the command window, with something like:
Private Sub commandbutton1_click()

End Sub

This means you're using an activex controll. If you want to, you can paste
your macro in there between the Sub lines.

If the "Assign macro" does appear in gray, it's an Excel "feature". Try
clicking somewhere else on the sheet and then retrying (more than once if
necessary). It will appear activated eventually.
 
G

Gord Dibben

Create the button using the Forms Toolbar and not the Control ToolBox

Then you will get the Assign Macro option.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top