S
scott
I'm trying to use an "Instr" test with a case statement. Is this possible?
In my code below, I'm trying to test the first 2 characters in a string and
determine if the string begins with "f_" or "r_". Can someone take a stab at
my code? It returns "unknown" instead of "f_"?
CODE: ***************************
Public Sub TestCase()
Dim sString As String
sString = "f_test1"
Select Case sString
Case InStr(2, sString, "f_") > 0
Debug.Print "Caught f_"
Case InStr(2, sString, "r_") > 0
Debug.Print "Caught r_"
Case Else
Debug.Print "Unknown"
End Select
End Sub
In my code below, I'm trying to test the first 2 characters in a string and
determine if the string begins with "f_" or "r_". Can someone take a stab at
my code? It returns "unknown" instead of "f_"?
CODE: ***************************
Public Sub TestCase()
Dim sString As String
sString = "f_test1"
Select Case sString
Case InStr(2, sString, "f_") > 0
Debug.Print "Caught f_"
Case InStr(2, sString, "r_") > 0
Debug.Print "Caught r_"
Case Else
Debug.Print "Unknown"
End Select
End Sub