View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych[_2_] Tim Zych[_2_] is offline
external usenet poster
 
Posts: 41
Default help with Or statement

Select Case frmMaintest.CBox1.Text
Case "bob", "george", "kevin"
MsgBox "You must select another name!"
Exit Sub
Case "john", "tom"
MsgBox "This name is acceptable!"
End Select


"Bob C" wrote in message
...
Can someone tell me how I can shorten the below "Or" statement without
repeating the entire string?

If (frmMaintest.CBox1.Text = "bob") Or (frmMaintest.CBox1.Text = "george")
Or (frmMaintest.CBox1.Text = "kevin") Then
MsgBox "You must select another name!"
Exit Sub
ElseIf (frmMaintest.CBox1.Text = "john") Or (frmMaintest.CBox1.Text =

"tom")
Then
MsgBox "This name is acceptable!"
End If