ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Input Of A Number (https://www.excelbanter.com/excel-programming/315743-user-input-number.html)

Chuckles123[_43_]

User Input Of A Number
 

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

--
Chuckles12
-----------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494
View this thread: http://www.excelforum.com/showthread.php?threadid=27517


Ivan F Moala[_43_]

User Input Of A Number
 

Chuckles123 Wrote:
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

--
Ivan F Moal

-----------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...nfo&userid=195
View this thread: http://www.excelforum.com/showthread.php?threadid=27517


Myrna Larson

User Input Of A Number
 
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.

On Thu, 4 Nov 2004 00:33:21 -0600, Chuckles123
wrote:


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




All times are GMT +1. The time now is 01:44 PM.

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