+ Reply to Thread
Results 1 to 2 of 2

Data Validation

Hybrid View

  1. #1
    Registered User
    Join Date
    08-18-2007
    Posts
    62

    Question Data Validation

    I have data entry form that the first input should be a unit number consisting of 6 numbers in a text box,. This input puts the 6 numbers in a dataTable in a sheet (Ex, sheet 1 cell A1). How can validate this input, in VBA ?
    I formatted the cell in the target sheet, but I need to validate in the input from. I want to make the user to stop by popping a msgbox alerting that he/she needs to input 6 number not 1,2 3 4, 5 ,7 etc, or any other data type (or even better disable all the other input objects to be disable if the user doesn’t input the 6 integers).

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    You dont necessarily need VBA. You can apply a data validation to a cell (or column) that only allows a 6 digit number to be entered.

    Choose the cell upon which you would like to apply the data validation.
    Go to DATA- Validation
    From the allow dropdown, choose CUSTOM
    Enter this formula: =AND(LEN(A1)=6,ISNUMBER(A1)=TRUE) *NOTE: This assumes that you are applying the validation to cell a1. Change the range to suit.
    Next, you can use the other tabs in the validation dialog box to nter custom error messages, and other options.

    Report back if this helps

+ 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