Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Numbers Only in input box

Hi all,

Just wondering how I can have the following code to check if the answer is
only in numeric form?

dim Checker

checker = inputbox("What is the player's registration number?")


Thanks in advance

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Numbers Only in input box

Sorry just to add to that if the answer is not right can it be looped back
to the inputbox again

Thanks

Greg
"Greg" wrote in message
...
Hi all,

Just wondering how I can have the following code to check if the answer is
only in numeric form?

dim Checker

checker = inputbox("What is the player's registration number?")


Thanks in advance

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Numbers Only in input box

The following code will loop until the user enters a number greater than 10.
Note that the code uses Excel's InputBox method, not the standard VBA
InputBox function. The 'Application.' is required.

Dim D As Double
Do Until D 10
D = Application.InputBox(prompt:="Enter a number.", Type:=1)
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Greg" wrote in message
...
Sorry just to add to that if the answer is not right can it be looped
back to the inputbox again

Thanks

Greg
"Greg" wrote in message
...
Hi all,

Just wondering how I can have the following code to check if the answer
is only in numeric form?

dim Checker

checker = inputbox("What is the player's registration number?")


Thanks in advance

Greg






  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Numbers Only in input box

you could try the inputbox method (versus inputbox function). it will
restrict the input to numbers, but you still have to check to see if they
canceled the inputbox.

Sub test()
Dim checker As Long

checker = Clng(Application.InputBox("What is the player's registration
number?", Type:=1))
If checker = 0 Then Exit Sub

End Sub






"Greg" wrote:

Hi all,

Just wondering how I can have the following code to check if the answer is
only in numeric form?

dim Checker

checker = inputbox("What is the player's registration number?")


Thanks in advance

Greg



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Numbers Only in input box

Thanks for that Chip will try

Greg
"Chip Pearson" wrote in message
...
The following code will loop until the user enters a number greater than
10. Note that the code uses Excel's InputBox method, not the standard VBA
InputBox function. The 'Application.' is required.

Dim D As Double
Do Until D 10
D = Application.InputBox(prompt:="Enter a number.", Type:=1)
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Greg" wrote in message
...
Sorry just to add to that if the answer is not right can it be looped
back to the inputbox again

Thanks

Greg
"Greg" wrote in message
...
Hi all,

Just wondering how I can have the following code to check if the answer
is only in numeric form?

dim Checker

checker = inputbox("What is the player's registration number?")


Thanks in advance

Greg










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Numbers Only in input box

Thanks for that it works great

Greg
"Greg" wrote in message
...
Thanks for that Chip will try

Greg
"Chip Pearson" wrote in message
...
The following code will loop until the user enters a number greater than
10. Note that the code uses Excel's InputBox method, not the standard VBA
InputBox function. The 'Application.' is required.

Dim D As Double
Do Until D 10
D = Application.InputBox(prompt:="Enter a number.", Type:=1)
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Greg" wrote in message
...
Sorry just to add to that if the answer is not right can it be looped
back to the inputbox again

Thanks

Greg
"Greg" wrote in message
...
Hi all,

Just wondering how I can have the following code to check if the answer
is only in numeric form?

dim Checker

checker = inputbox("What is the player's registration number?")


Thanks in advance

Greg










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
finding 10 smallest numbers from last 20 input handicapper Excel Worksheet Functions 8 May 3rd 10 02:29 PM
How do I update a spreadsheet with numbers input into another? Duma New Users to Excel 2 March 23rd 08 02:56 AM
numbers are changes when input dna Excel Discussion (Misc queries) 4 March 9th 07 01:04 AM
Sum of Numbers Smaller than input scott Excel Discussion (Misc queries) 4 August 2nd 06 09:18 PM
Sum of Numbers Smaller than input David Billigmeier Excel Discussion (Misc queries) 0 August 2nd 06 08:43 PM


All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"