I am new to VBA. I am constructing a VBA userform. I want to restrict input into one of the textboxes to either a 16 or 21 character string with only numerals or spaces (the spaces are to be entered automatically). The first 5 digits are static for both formats, i.e.
format for 16 digit is "84271 ##### ####"
format for 21 digit is "84271 ##### #### ####"
I have created the following code:
This tests and works correctly for the 21 character input. It is not reading the 16 character format as when I enter 9 numerals, I get the following:
84271 1 2345 6789
and my message box appears asking for a 9 or 13 digit input.
Any help would be appreciated.
Thank you.
Bookmarks