+ Reply to Thread
Results 1 to 7 of 7

Test that form input is 6 digits only

  1. #1
    Forum Contributor
    Join Date
    10-08-2012
    Location
    San Clemente, California
    MS-Off Ver
    Office365
    Posts
    383

    Test that form input is 6 digits only

    My form gets a stock number from the user. The number must be 6 digits only. How can I validate that the input is exactly that? The value can be anything from 000001 through 999999.

    Thanks for your input!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Test that form input is 6 digits only

    Hello snapfade,

    Is this stock number input on a worksheet?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    03-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    491

    Re: Test that form input is 6 digits only

    I'm fairly new to VBA but maybe I can steer you in the right direction...
    Maybe...
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 11-22-2013 at 05:26 PM. Reason: Added Code Tagas

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Test that form input is 6 digits only

    Try something like this...

    If TextBox1.Value Like "######" Then
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Forum Contributor
    Join Date
    10-08-2012
    Location
    San Clemente, California
    MS-Off Ver
    Office365
    Posts
    383

    Re: Test that form input is 6 digits only

    Hi Leith,

    Thanks for your input.

    The input is from a form and the result will be put into a worksheet.

  6. #6
    Forum Contributor
    Join Date
    10-08-2012
    Location
    San Clemente, California
    MS-Off Ver
    Office365
    Posts
    383

    Re: Test that form input is 6 digits only

    Hi AlphaFrog,

    Thanks for your input. The solution is perfect!

    Thanks!

  7. #7
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Test that form input is 6 digits only

    Quote Originally Posted by AlphaFrog View Post
    Try something like this...

    If TextBox1.Value Like "######" Then
    Nice AlphaFrog!!

+ 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. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  2. Replies: 1
    Last Post: 11-10-2011, 09:02 PM
  3. Looping a data input form based on form option
    By bologne in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-17-2011, 03:06 AM
  4. Permuation of 4 digits but not equal to input
    By yeksm in forum Excel General
    Replies: 2
    Last Post: 01-07-2008, 05:20 AM
  5. Replies: 2
    Last Post: 01-25-2006, 07:50 PM

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