Hi everyone,
I'm making a payroll management system, complete with payslips, employee files, tax forms, punch system for employees, etc.
To add a new employee to the system, I have a Userform full of text boxes, option buttons, list boxes... I have a textbox for Social Security Number. For the sake of readability, I want a space added after the first 3 digits then another after the next 3 digits, giving me something like ### ### ###. I managed to add the spaces with If statements in the textbox_Change sub but if I hit backspace, I can't get passed the spaces.
Here's my code:
This causes the problem that when you encounter one of these spaces you get back to the length that requires a space, puts it back and you can't go back further. I tried using Textbox_KeyPress and Textbox_KeyDown to keep only the left 2 or 6 characters and end up with only the left 1 or 5 characters.
Anyone has any idea how I could achieve this?
Bookmarks