View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DennisE DennisE is offline
external usenet poster
 
Posts: 66
Default Need help with the Like Operator

Excel gurus:

Users enter numerical data into input boxes in my UserForms
in text form like $1,345,561.50 or as arithmetic expressions
like $40,000*(1.03)^2.5, and to check that no extraneous
characters have been inadvertently keyed in, I do the following:

Sub MyTextBox_AfterUpdate
If MyTextBox.Text Like "*[a-zA-Z`~!@#&_=:;|\<'?{}""]*" Then
MsgBox "Sorry, you have entered an illegal character."
End If
End Sub

Rather than doing it that way, is it possible to somehow use the
Like operator in a complementary manner, in which the arguments
enclosed in brackets are the symbols that are permitted;
that is, [0-9$,.+-*/^()]

-- Dennis Eisen