ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Form Formula (https://www.excelbanter.com/excel-programming/334984-user-form-formula.html)

sbruner

User Form Formula
 
I have created the template for a user form at the beginning of a macro. It
simply asks the user to enter a product code and click Ok.
I am not a professional programmer and am unsure how to take the information
that the user inputs and store it as a variable to be repeatedly called up in
my macro at various points. Can anyone help?

Jim Thomlinson[_4_]

User Form Formula
 
Your question is kind of vague so here is a very generic bit of code for you
to loo at...

Public Sub GetDataFromUser()
Dim strUserInput As String

strUserInput = InputBox("Please enter your name.", "Name")

MsgBox "Your name is " & strUserInput

Call GetAddress(strUserInput)
End Sub

Private Sub GetAddress(ByVal UserName As String)
Dim strAddress As String

strAddress = InputBox("Hi, " & UserName & ". What is your address",
"Address")

MsgBox UserName & " lives at " & strAddress

End Sub

It gets the user to inut their name. That name is output and then passed to
another procedure to be used some more.
--
HTH...

Jim Thomlinson


"sbruner" wrote:

I have created the template for a user form at the beginning of a macro. It
simply asks the user to enter a product code and click Ok.
I am not a professional programmer and am unsure how to take the information
that the user inputs and store it as a variable to be repeatedly called up in
my macro at various points. Can anyone help?


Bob Phillips[_7_]

User Form Formula
 
ans = Inputbox("Please supply a product code")

--
HTH

Bob Phillips

"sbruner" wrote in message
...
I have created the template for a user form at the beginning of a macro.

It
simply asks the user to enter a product code and click Ok.
I am not a professional programmer and am unsure how to take the

information
that the user inputs and store it as a variable to be repeatedly called up

in
my macro at various points. Can anyone help?




jjk

User Form Formula
 
You should look up some tutorials.

Reading the codes from these projects is a good start.
<single line
http://support.microsoft.com/search/... orm+tutorial
</single line



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

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