Validation in a userform
Find bottlenecks in your Excel workbooks
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Validation in a userform

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     

    How would I validate a userform text box, so there cn only be 4-8 characters in it? Thanks alot for any help.

  2. #2
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Location
    Flanders
    Posts
    484
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    set the property MaxLength of your textbox to 4 or 8
    If the text must be -at least- 4 characters, you can controle the textlength with something like this :

    if userform1.TextBox1.TextLength < 4 then
    msgbox "The text is too short."
    end if
    _________________


    Bruno


    [ This Message was edited by: Bruno on 2002-03-08 04:42 ]

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com