Create a simple input box

  • Thread starter Thread starter Marilyn
  • Start date Start date
M

Marilyn

Hello How do I create input box asking the user to type in the term of
agreement
1, 2, 3, 0r 4 years
or where can I get instructions to do this. I have a book but the
instructions are not very clear to me. thanks
 
myNum = Application.InputBox("C")

Press ALT-11 to open VBEditor, search for InputBox.

The above will prompt the user with "Enter a number" and store the response
in the variable myNum.
 
Option Explicit
Sub testme()

Dim myNum As Long
myNum = CLng(Application.InputBox(Prompt:="1, 2, 3, or 4", Type:=1))

If myNum < 1 _
Or myNum > 4 Then
MsgBox "Please try again!"
Exit Sub
End If

'your code to do the work goes here
MsgBox myNum

End Sub
 
Hi,

If you are in the spreadsheet, you might consider Data, Validation, List and
enter 1 year, 2 years, 3 years, 4 years as the Source. Personally, I would
enter the 1 year, 2 years,... in a range and reference the range in the
Source box. Then click the second tab, Input Message and type a message to
tell the user what you want them to do.
 
Thanks, Perfect
Is it possible to have the answer entered in a cell , that is if the answer
is 2 the number 2 appear in cell D5
thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Input Box 2
Input box data check 5
Interactive Data Input Boxes 6
Input box to find date 4
Input Box Question 2
Popup Input Box 6
Input box and filters 3
Creating a simple drawing using Excel 2

Back
Top