LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #20   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Checking Input box

Hi AMK4,
Just in case the line breaks are a problem (which they probably aren't
for you) here's the code in direct pastable form (I hope, it's always a
gamble)

Sub copyData()
Dim myPageInput 'was String
Dim ValidPage As Boolean
Do While Not ValidPage
myPageInput = Application.InputBox( _
prompt:="Which form should this go on? (1 through 4)", _
Title:="Form number", Type:=2)
'Your 2nd AND in next line made no difference so I took it out
If Application.IsLogical(myPageInput) And myPageInput < True _
Then Exit Sub
ValidPage = True
'with variant myPageInput next three lines work
On Error Resume Next
If myPageInput < 1 _
Or myPageInput 4 _
Or Int(myPageInput) < CSng(myPageInput) Then 'back in
'+ test for integer
On Error GoTo 0
ValidPage = False 'back in
End If 'back in
If Not ValidPage Then _
MsgBox "Only values between 1 and 4 are allowed.", 16 'back in
Loop
MsgBox "myPageInput: " & myPageInput, 64
End Sub
Ken Johnson



 
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
checking input in a cell and return by copying info from a other c Golf-Iron7 Excel Worksheet Functions 4 February 27th 10 04:07 AM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
checking input on a textbox in userform to be a % Jean-Pierre D via OfficeKB.com Excel Programming 11 August 25th 05 11:39 PM
Checking input for alphabet (i.e. words) Neal[_5_] Excel Programming 1 February 12th 04 01:50 AM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 09:02 PM.

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"