LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Whole Number Validation in Input Box

I am having problems with an input box. The user can only put in a whole
number greater than or equal to 3. If they put in text or a decimal, I want
it to display an error and reopen the dialogue box. I got the text part, but
not the decimal validation. Any suggestions? The example of the code thus
far is written below.

'The user is now asked to input the number of sides in the box.
'The only valid answers is a numeric whole number greater than or equal to 3

Dim c As Integer, sides As Variant
c = 3
sides = Application.InputBox("Please enter the number of sides of your box",
"Box Geometry", c)
If sides = False Then GoTo 100
If sides = "" Or Not IsNumeric(sides) Then GoTo 2 Else GoTo 3
2
Repsonse = MsgBox("Your input must be a whole number greater than 3. Try
again.", vbOKOnly, "Error")
GoTo 1
3
If sides < 3 Then GoTo 2 Else GoTo 4
4
100
 
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
What is input validation? Rich Excel Discussion (Misc queries) 1 September 7th 09 03:44 PM
Validation Input Text Chris waller Excel Discussion (Misc queries) 1 March 5th 09 09:30 PM
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
input masks and validation archiboy Excel Discussion (Misc queries) 3 October 11th 05 03:05 PM
Help with VBA Input Validation Jim[_56_] Excel Programming 1 January 24th 05 10:29 PM


All times are GMT +1. The time now is 08:41 AM.

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

About Us

"It's about Microsoft Excel"