Computing.Net > Forums > Office Software > Cell input

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Cell input

Reply to Message Icon

Name: gasaboo
Date: April 3, 2009 at 00:40:11 Pacific
OS: Windows XP
Subcategory: Microsoft Office
Comment:

How do I set up a cell to receive or allow only the numbers 1,2,3,4 or 5 to be entered.



Sponsored Link
Ads by Google

Response Number 1
Name: angrymen2001
Date: April 3, 2009 at 04:48:46 Pacific
Reply:

rather than repeating the help file,
Go to the MS help and type
Enter data in a cell from a list you specify
This will teach you how to set up a drop down list
By creaing a drop down selection, it will limit the selection to your request

What happened to my quote


0

Response Number 2
Name: DerbyDad03
Date: April 3, 2009 at 11:59:56 Pacific
Reply:

Here's some code I wrote many years ago, updated to fit your requirements.

Read the MsgBox texts....

Sub GetValue1_5()
GetNumber:
Number = InputBox("Enter an Integer Value between 1 and 5")
If Int(Number) - Number <> 0 Or Number < 1 Or Number > 5 Then
    X = X + 1
    Select Case X
     Case 1
        MsgBox ("You must enter a value between 1 and 5")
        GoTo GetNumber:
     Case 2
        MsgBox ("Come on...it's not that hard." _
                 & Chr(10) & "Enter 1 or 2 or 3 or 4 or 5!")
        GoTo GetNumber:
     Case 3
        MsgBox ("Look, this is getting annoying!" _
                 & Chr(10) & "Do you even know how to count?")
        GoTo GetNumber:
     Case 4
        MsgBox ("All right, last chance! I know where you live!" _
                 & Chr(10) & "Give me a value between 1 and 5!")
        GoTo GetNumber:
     Case 5
        MsgBox ("That's it! I'm on my way to your house!")
        'Application.HurtUser Severity.Badly = True
    End Select
 End If
End Sub


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Importing names & ranges hard disk full error



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Cell input

Excel VB Syntax www.computing.net/answers/office/excel-vb-syntax/397.html

Excel quick addition of many cells www.computing.net/answers/office/excel-quick-addition-of-many-cells/1749.html

referencing cells in formulas www.computing.net/answers/office/referencing-cells-in-formulas-/6510.html