How do,
How would i set criteria to a userform textbox to only allow a valid 11 digit mobile number ?
How do,
How would i set criteria to a userform textbox to only allow a valid 11 digit mobile number ?
Restricting it to 11 numerical digits is common. So is formatting it with Spaces, parentheses and dashes, but...
How is it supposed to know a mobile number from a land line number?
You will have to provide a list of acceptable area codes, and maybe prefixes. Or list of unacceptable ones.
The list can be in the structure of a collection, a dictionary, a select case, Module Properties, or a simple list stored on a worksheet.
derrr. Completely over looked that one.Originally Posted by SamT
what about keeping it simple and just stipulating that it has to start with 07?.
I'm happy to leave it to the possiblilty of the user sussing out that they could just type "07000000000", as 1/ this is unlikley.. and 2/ they will be pasting the number in most of the time, so its more, just a case of nudging the user to point out a typo more than anything.
Reeeaaal Simple
[VBA]If Left(TextBox1, 2)<> "07" Then TextBox1 = ""[/VBA]
Thanks for your help samT.... just to push my luck, how could that be adjusted to require 11 digits
[VBA]If Len(TextBox1) <> 11 then TextBox1 = ""[/VBA]
Thank you SamT, sorry for the late response