C
corky_guy
Hi -
I'm trying to write a simple bit of code that simply checks for proper
formatting of text. The problem is that the code I have used does not
seem to properly work. Can someone offer a suggestion of how to fix?
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
If (Not Left(.Text, 3) Like "so-") Or (Not Left(.Text, 3) Like
"t3-") Then
MsgBox "so-x/x/x or t3-x/x/x"
Cancel = True
End If
End With
End Sub
Basically, the inputted text MUST BE either: so-x/x/x or t3-x/x/x --
it cannot be anything other than that.
Thank you for any help you can provide.
I'm trying to write a simple bit of code that simply checks for proper
formatting of text. The problem is that the code I have used does not
seem to properly work. Can someone offer a suggestion of how to fix?
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
If (Not Left(.Text, 3) Like "so-") Or (Not Left(.Text, 3) Like
"t3-") Then
MsgBox "so-x/x/x or t3-x/x/x"
Cancel = True
End If
End With
End Sub
Basically, the inputted text MUST BE either: so-x/x/x or t3-x/x/x --
it cannot be anything other than that.
Thank you for any help you can provide.