+ Reply to Thread
Results 1 to 9 of 9

VBA Validate textbox value to have alphanumeric characters

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    57

    VBA Validate textbox value to have alphanumeric characters

    Hi all!

    Please assist me in solving this problem.
    I just want the textbox to check upon exit event if the value entered is alphanumeric.
    I have a code that checks every keypress if user enters non-alphanumeric characters. But again, I also want it to make sure that user entered alphanumeric characters coz this textbox is for user password.

    Thanks!

    Here's my code:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: VBA Validate textbox value to have alphanumeric characters

    Would something like this help you out?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-15-2013
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: VBA Validate textbox value to have alphanumeric characters

    Hi BigBas!
    Thanks for replying
    I tried your code but the textbox accepts all type of entries upon exit, may it be letters only, numbers only, or aplhanumeric.

    Any more insight?
    Thanks!

    Any more insight?
    Thanks!

  4. #4
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: VBA Validate textbox value to have alphanumeric characters

    Perhaps I misunderstood your request. You are correct, the code allows letters, numbers, or both. Are you asking to REQUIRE that the user enter at least one letter and one number?

  5. #5
    Registered User
    Join Date
    01-15-2013
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: VBA Validate textbox value to have alphanumeric characters

    Quote Originally Posted by BigBas View Post
    Perhaps I misunderstood your request. You are correct, the code allows letters, numbers, or both. Are you asking to REQUIRE that the user enter at least one letter and one number?
    Yes, BigBas! I'm sorry if I confused you. This textbox is where user needs to enter their new password. And I believe, for better security, it's better for a password to be alphanumeric, right?

    Thanks again in advance!

  6. #6
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: VBA Validate textbox value to have alphanumeric characters

    That sounds right. Earlier, I though you were trying to block the user from entering NON alpha-numeric data (special characters such as: ! @ # $ etc).

    The below code requires at least 1 letter and 1 number. You can further strengthen the password by requiring a minimum length, or any other requirements.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: VBA Validate textbox value to have alphanumeric characters

    Hi,

    I always thought lower case, upper case along with numbers in a password made it stronger. See:
    http://netforbeginners.about.com/od/...g-password.htm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  8. #8
    Registered User
    Join Date
    01-15-2013
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: VBA Validate textbox value to have alphanumeric characters

    Thank you so much, BigBas!!!
    That worked perfectly! Also, I limit the password length to 10 characters only, as you recommended.

    Hi MarvinP,
    I'll also look into your link to find more insights. For now, I'm tagging this post as SOLVED!

    Thanks for this forum as always!

  9. #9
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127

    Re: VBA Validate textbox value to have alphanumeric characters

    Glad to help!

+ 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