ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Assigning Macro to a Command Button (https://www.excelbanter.com/excel-discussion-misc-queries/172604-assigning-macro-command-button.html)

melaniem

Assigning Macro to a Command Button
 
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.

Mike Rogers[_2_]

Assigning Macro to a Command Button
 
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

"melaniem" wrote:

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.


Sian

Assigning Macro to a Command Button
 
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.

Gord Dibben

Assigning Macro to a Command Button
 
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

On Thu, 10 Jan 2008 19:59:21 -0800, melaniem
wrote:

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.




All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com