User Input Of A Number

  • Thread starter Thread starter Chuckles123
  • Start date Start date
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
 
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
 
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.
 
Back
Top