#1
|
||||
|
||||
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 Code:
If instr(1,MyString,"BFSTV")>0 |
#2
|
||||
|
||||
I found the answer. Just code a list.
Code:
Select Case UCase(MyString) Case "" MsgBox "Macro aborted", , MyName Case "A" Call SubA Case "B", "F", "S", "T", "V" Call SubMisc Case "G" Call SubG Case Else MsgBox "Invalid data" End Select |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regular expressions: lower case after hyphen | SusanG | Word | 2 | 06-06-2012 11:58 PM |
Custom Text Filter for this particular case | tinfanide | Excel | 2 | 09-13-2011 05:08 AM |
Case Sensitive (contains) Selection | apolloman | Excel | 2 | 07-12-2011 04:50 AM |
From all UPPER CASE to Proper Case | davers | Word | 1 | 04-30-2009 12:41 PM |
Upper to lower case | jd | Excel | 1 | 04-28-2006 07:40 AM |