View Single Post
 
Old 01-05-2013, 02:15 PM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Windows XP Office 2007
Competent Performer
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Question about Case statement

Can I have a Case statement that can test for multiple values at one branch?

In the code below, I'd like the third Case statement to execute if MyString contains any of the characters "BFSTV".
Code:
Select Case UCase(MyString)
  Case ""
    MsgBox "Macro aborted", , MyName
  Case "A"
    Call SubA
  Case "BFSTV" ???   'What can go here???
    Call SubMisc
  Case "G"
    Call SubG
  Case Else
    MsgBox "Invalid data:
End Select
That is, I'd like to run this test:
Code:
If instr(1,MyString,"BFSTV")>0
Reply With Quote