View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob C[_2_] Bob C[_2_] is offline
external usenet poster
 
Posts: 2
Default help with Or statement

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