Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
Is there a way to insert a character while the user is still typing. For example if the user is entering the date, automatically insert either a "-" or "," or "/", or a "." after the first two characters. For this instance I just need to insert the character after the two digit month followed by either a two or four digit year.
For example: 06/2019(prefered format), 06-2019, 06.2019, etc....
I was able to achieve this within the exit event but not in the change event. Not sure why.
Here's my code for the exit event.
Thank You
For example: 06/2019(prefered format), 06-2019, 06.2019, etc....
I was able to achieve this within the exit event but not in the change event. Not sure why.
Here's my code for the exit event.
Code:
Private Sub txtbxExpDte_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Mid(txtbxExpDte, 3, 1) = "/" Then
Exit Sub
Else
txtbxExpDte.Value = Left(txtbxExpDte, 2) & "/" & (Mid(txtbxExpDte, 3, 5))
End If
End Sub
Thank You