Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Running a Macro through a button vs. VBA

I just created a simple macro to run in one of my workbooks. When I enter
visual basic and click Run Sub/User Form, the macro works fine. However,
when I create a command button, type the name of the macro in the code for
the button, and then push the button, I get a Compile Error:Argument Not
Optional. I have several other command buttons in this workbook that work
fine. Is there any way to fix this? It's kind of a pain to have to go into
visual basic and click run instead of just clicking a button.

Thanks

Adam Bush
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Running a Macro through a button vs. VBA

On Aug 30, 3:00 pm,
m wrote:
I just created a simple macro to run in one of my workbooks. When I enter
visual basic and click Run Sub/User Form, the macro works fine. However,
when I create a command button, type the name of the macro in the code for
the button, and then push the button, I get a Compile Error:Argument Not
Optional. I have several other command buttons in this workbook that work
fine. Is there any way to fix this? It's kind of a pain to have to go into
visual basic and click run instead of just clicking a button.

Thanks

Adam Bush


Adam,
Delete your button. Make sure that you have the Forms tool bar open.
Go to Toolbars, Right click, Pick Forms. Now insert the button. It
shodul pop up and ask you what Macro you want to add to the button.
You may have been using the Control Tool bar instead of the forms.
The buttons work a little differently.
Jay

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Running a Macro through a button vs. VBA

Thank you very much Jay that worked perfectly.

Adam Bush

"jlclyde" wrote:

On Aug 30, 3:00 pm,
m wrote:
I just created a simple macro to run in one of my workbooks. When I enter
visual basic and click Run Sub/User Form, the macro works fine. However,
when I create a command button, type the name of the macro in the code for
the button, and then push the button, I get a Compile Error:Argument Not
Optional. I have several other command buttons in this workbook that work
fine. Is there any way to fix this? It's kind of a pain to have to go into
visual basic and click run instead of just clicking a button.

Thanks

Adam Bush


Adam,
Delete your button. Make sure that you have the Forms tool bar open.
Go to Toolbars, Right click, Pick Forms. Now insert the button. It
shodul pop up and ask you what Macro you want to add to the button.
You may have been using the Control Tool bar instead of the forms.
The buttons work a little differently.
Jay


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
Pop-up when running a macro tom Excel Discussion (Misc queries) 5 April 2nd 07 08:55 AM
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
Running one macro from another Megadrone Excel Worksheet Functions 4 December 5th 06 04:54 AM
disable user running macro from Tools Macro Steve Simons Excel Discussion (Misc queries) 4 September 28th 06 06:28 AM
Macro not running mowen Excel Discussion (Misc queries) 4 September 12th 05 06:33 PM


All times are GMT +1. The time now is 11:11 AM.

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

About Us

"It's about Microsoft Excel"