+ Reply to Thread
Results 1 to 6 of 6

Do not allow user to enter wrong number

  1. #1
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Do not allow user to enter wrong number

    Hi, users enter in Column "I" multiple numbers such as 014320008006, or 87569387900 and so forth. What is not valid is to enter values ending in triple 0 such as 014320008000 or 0193879000.

    What would be a code to automatically advise the user that the number is incorrect, clear data and tell him to enter a correct number?

    Thanks,

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Do not allow user to enter wrong number

    Are you required to use VBA? Excel has a built in Data validation feature that can be set up to do this. https://support.office.com/en-us/art...6-eff3ce5f7249 Set up the data validation to custom and set the formula to =MOD(A1,1000)<>0 -- which will tell Excel to allow any entry that is not an even multiple of 1000, but will block any entry that is an even multiple of 1000.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Do not allow user to enter wrong number

    Hi thanks for the quick reply. Yes I am looking for a VBA solution.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Do not allow user to enter wrong number

    .
    This macro works here.

    Paste this in the Sheet level module of the target sheet :

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-14-2015
    Location
    Mexico
    MS-Off Ver
    365
    Posts
    279

    Re: Do not allow user to enter wrong number

    thank you so much, it worked!!

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Do not allow user to enter wrong number

    .
    You are welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Vba to generate Reference Number, input box for user to enter 1st Ref
    By jp16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2018, 11:41 PM
  2. Replies: 5
    Last Post: 04-04-2018, 01:48 PM
  3. How to prevent user to enter serial number in column B manually
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-27-2015, 09:50 AM
  4. [SOLVED] Repeat Inputbox if user click cancel or if user enter character not in selection criteria
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-24-2014, 02:44 AM
  5. [SOLVED] How to pop up message when user enters any text in TextBox. Should be enter by number only
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-21-2013, 02:26 AM
  6. Replies: 1
    Last Post: 06-15-2011, 02:36 AM
  7. Allowing user to enter either percentage or number
    By Destruction in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-13-2011, 09:36 AM

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