ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   execute a macro from a dialog box on enter (https://www.excelbanter.com/excel-programming/420546-execute-macro-dialog-box-enter.html)

chenbear

execute a macro from a dialog box on enter
 
in lotus i use .. aj.macrorun at the end of the code.. but in excel i do not
know the code to do the same..i want to run a macro which copys from a1 and
puts it in d1 so if i use a dialog box and put my name ..johnny and press
enter it should put johnny in a1 then the macro will copy from a1 and put it
in d1 when i press enter from the dialog box i can use two buttons and it
will work but i only want one but when i use the code together it does not do
the same as two seperate buttons this is whay i want to run the second from a
macro

JLGWhiz

execute a macro from a dialog box on enter
 
There are several ways to run a macro in Excel.

You can click ToolsMacroMacros which brings up the dialog box with all the
macros in the standar mocule listed. You can then click on the name of the
one you want to run and it will then appear in the small window of the dialog
box. Cliock Run.

You can open the dialog box as dexcribed above and click the Options button
at lower right. This action brings up a second dialog box that alloiws you
to assign a keyboard shortcut to run the macro.

You can put a button from the Forms toolbar on a sheet and assign a macro to
it. If the option toolbar does not appear when you create the button then
right click the button and select "Assign Macro" from the pop up menu.

You can put a button from the Control Tooilbox Toolbar on a sheet and while
in design mode, right click it, choose view code from the pop up menu and put
code similar to this in the code module for the button.

Private Sub CommandButton1_Click()
Call Macro1(arg) 'Or whatever your macro is named
End Sub

Of course, the above also demonstrates that macros can be called from other
macros. But if the macro is not in the public module, also referred to as
the standard code module or module1, then you will have to be specific to
call the macro from another macro. i.e. Call Sheet1!Macro1(arg). Note
that if the parentheses are used, the arguments must also be included.

"chenbear" wrote:

in lotus i use .. aj.macrorun at the end of the code.. but in excel i do not
know the code to do the same..i want to run a macro which copys from a1 and
puts it in d1 so if i use a dialog box and put my name ..johnny and press
enter it should put johnny in a1 then the macro will copy from a1 and put it
in d1 when i press enter from the dialog box i can use two buttons and it
will work but i only want one but when i use the code together it does not do
the same as two seperate buttons this is whay i want to run the second from a
macro



All times are GMT +1. The time now is 04:55 PM.

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