Hi everyone,
I have a problem. I have a userform in which users input a phone number into one of the fields. the users have not been inputting the number with the correct format (i would like it to be (123) 456-7890 ).
Juan gave me the code:
Private Sub ContractorPhone_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
ContractorPhone = Format(ContractorPhone, "(###) ###-####")
End Sub
and it works, EXCEPT when the user inputs the number like this: 123-456-7890
In this case, the number does not change to the correct format. How can i fix this? Is there a way to replace the - with a "" then i can format it? Ive tried messing around with it, but havent figured it out.
Thanks for any help
I have a problem. I have a userform in which users input a phone number into one of the fields. the users have not been inputting the number with the correct format (i would like it to be (123) 456-7890 ).
Juan gave me the code:
Private Sub ContractorPhone_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
ContractorPhone = Format(ContractorPhone, "(###) ###-####")
End Sub
and it works, EXCEPT when the user inputs the number like this: 123-456-7890
In this case, the number does not change to the correct format. How can i fix this? Is there a way to replace the - with a "" then i can format it? Ive tried messing around with it, but havent figured it out.
Thanks for any help