User Input Of A Number

C

Chuckles123

Looking for guidance on constructing code to pause macro and have use
input a 2- or 3-digit number, and then macro continuing. Also, i
would be useful for macro, after results are displayed in spreadsheet
to loop back to input option.
Thanks in advance.
Chuckles12
 
I

Ivan F Moala

Chuckles123 said:
Looking for guidance on constructing code to pause macro and have use
input a 2- or 3-digit number, and then macro continuing. Also, i
would be useful for macro, after results are displayed in spreadsheet
to loop back to input option.
Thanks in advance.
Chuckles123

Hi Chuckles123

What you need to use is the Application.Inputbox function.

Have a look in your help files .....

example something like this

Sub Tester()
Dim Result

Again:
Result = Application.InputBox("Enter 2 or 3 didgit number", Type:=1)
If Result = False Then Exit Sub
If Len(Result) > 3 Or Len(Result) < 2 Then GoTo Again

MsgBox Result

End Su
 
M

Myrna Larson

Check out the InputBox function in Help. If you want a loop, you use a Do/Loop
construction. That's also explained in Help. There should also be examples.
 

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

Top