• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Correct Code

delta

Member
in userform1 in textbox1 contain code for user enter only 10 digit number. but problem is when userform close then message box show textbox1 enter only 10 digit no what is incorrect in this code i attache the sample file
 

Attachments

Hui

Excel Ninja
Staff member
Your line
If IsNumeric(Me.TextBox1.Value) And Len(Me.TextBox1.Value) = 10 Then

says if the Textbox is Numeric and if the Length of the value in Textbox 1 =10 then exit the sub

But seeing neither are true it doesnt exit and re-asks for input

Enter a value of 1234567890 and press exit and it works as written

You need to decide what you want to allow as an exit
 
Top