ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms, marcos, buttons? (https://www.excelbanter.com/excel-programming/429735-forms-marcos-buttons.html)

Lewej23

Forms, marcos, buttons?
 
In college I had an assignment that required me to create a button in a
worksheet that, when pressed, a form would come up where the user could input
information. I remember it had something to do with macros. Does anyone know
how to do this?

Patrick Molloy

Forms, marcos, buttons?
 
wow. I assume that you have a version of Excel?
go to the visual basic developement environment - ALT+F9
click Insert / Userform
this adds a basic userform with the default name, userform1
click Insert / Module
this opens a standard code module. Type (cut/paste) this into the module
SUB ShowTheForm()
userform1.Show
END SUB

go back to the spreadsheet
open the Forms menu and drag a button onto the worksheet - the Assign Macro
form opens automatically, select ShowTheForm and hit OK




"Lewej23" wrote in message
...
In college I had an assignment that required me to create a button in a
worksheet that, when pressed, a form would come up where the user could
input
information. I remember it had something to do with macros. Does anyone
know
how to do this?



Dennis Tucker

Forms, marcos, buttons?
 
Here is the basics.

1. Create the button on a worksheet -
Access View:Toolbars:Forms to display the "Forms" toolbar.
Click on the "Button" tool.
Click and drag the pointer across a small part of your worksheet.
The button should now be on your worksheet.
2. Edit the text on the button by clicking on the botton you just made then
typing something like "Start" or "GO".
3. Startup the VBA editor.
4. Add a code module to the workbook.
5. In the project explorer, double-click on the module you added. Then type
in the following

Sub MyMacro()

response=inputbox("Enter some text or number here.", "My Input Box")

End Sub

6. Then go back to your button on the worksheet and right-click on it.
Select the "Assign Macro" from the popup menu.
7. Double-click on the macro "MyMacro" that should be displayed on the
list.

Your done!

Click on the button you made on the worksheet and see what happens.


Dennis

"Lewej23" wrote in message
...
In college I had an assignment that required me to create a button in a
worksheet that, when pressed, a form would come up where the user could
input
information. I remember it had something to do with macros. Does anyone
know
how to do this?




All times are GMT +1. The time now is 05:27 PM.

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