Thread: Islike function
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Daniel Klann Daniel Klann is offline
external usenet poster
 
Posts: 15
Default Islike function

Hi,

This worked OK for me:-

Sub ValidateText()

Dim x

x = InputBox("Enter text")

If x Like "###/####-[A-Z]" Then
Debug.Print "Valid"
Else
Debug.Print "Invalid"
End If

End Sub

If you can't get this to work then you could try surrounding the / and - in
square brackets [ ].

Regards,
Daniel

http://www.danielklann.com


"Jamie" wrote in message
...
Hi All,

I want to put the following format as a requirement for
data entry via a userform:

123/4567-K

three numbers, a slash, four numbers, a dash follwed by a
letter.

I have tried ###/####-[A-Z]. It seems that I can not get
the slash and the dash. I am not sure of their format in
VB. Any help is appreciated. Thank you in advance.