If you open the userform in the attached workbook, you will see a textbox with the word "OPERATOR". This word is fixed and cannot be deleted as per the code which enables it. After that word, the textbox has visible space for 7 more characters. This means that the word "OPERATOR" and 7 characters can be visible in the box at the same time.
What I want is to have three numbers after the word, followed by a hyphen and then three further numbers. Therefore for example, I can have OPERATOR123-456 in the textbox. I want to have VBA that would format the box as the user types and automatically add the hyphen after the first three numbers perhaps. Finally, after the 6th number (i.e. the 7th character counting the hyphen) is entered, VBA code should prevent the user from entering any further characters in that box.
I am not looking for an Exit routine as I would like the box to be formatted as one types.
Any clue how to code this?
Bookmarks