+ Reply to Thread
Results 1 to 15 of 15

Data validation - Whole Numbers

  1. #1
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Data validation - Whole Numbers

    how can I set a cell so that you can only type in 1 , 2 , 3, 4, 5

    I know I can use the validation but people can just copy a cell and paste it over.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Under allow > select whole numbers

    Min 1
    Max 5

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Either you can set up a validation (as you mentioned) AND protect your worksheet to prevent people from copying/pasting over the validation, or you can use VBA (if you don't mind that) to prevent people from entering an incorrect value.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Sorry

    Misread the question.

    See if link helps

    http://www.j-walk.com/ss/excel/tips/tip98.htm

    VBA Noob

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Or a event macro. Right click sheet > select view code and paste in the below. Change range as required

    Please Login or Register  to view this content.
    VBA Noob

  6. #6
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Allow ?

    Sorry where can I specify allow ?

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

  8. #8
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Validation

    Please Login or Register  to view this content.
    HOW CAN I ADPAT THIS SO THAT Z3:Z500 IS RESTRICTED TO 1 , 2 OR 3 AS WELL AS THE ABOVE.

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Change to

    Please Login or Register  to view this content.
    VBA Noob

  10. #10
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    This is just a minor change to VBA Noob's code to disallow decimal numbers from being used in place of whole numbers:

    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Khalid, you need to combine them into one procedure:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    Please Login or Register  to view this content.
    VBA Noob

  13. #13
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    IM Nearly there

    Please Login or Register  to view this content.


    If Target.Value > 3 Or Target.Value <> Int(Target.Value) Then

    how do I change >3 to between 3 and 5 ie 3,4,5

  14. #14
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    help!!

    anybody out there ?

  15. #15
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Try this code and report back:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1