case is string contains string?

  • Thread starter Thread starter salgud
  • Start date Start date
S

salgud

I have played with it for an hour, but can't figure out how to make a case
statement that would be something like:

Case is = (string1 contains string2)

Is there a way to do this?
Thanks!
 
simplistic, but may give you an idea, since you didn't provide much.

Sub test()
Select Case True
Case InStr(1, "this is a test", "tst")
Debug.Print "True"
Case Else
Debug.Print "False"
End Select
End Sub
 
I have played with it for an hour, but can't figure out how to make a case
statement that would be something like:

Case is = (string1 contains string2)

Is there a way to do this?
Thanks!

Thanks to all!
 
Thanks to all!

Gave both methods a try, but neither works! I'm setting a case for
worksheets that have "Monthly" in their sheetname (sWsName)

I put in:

Case sWsName like "Monthly"

and

Case "Monthly" Like sWsName

and

Case instr(1,lcase(sWsName),"monthly")

and

Case InStr(1, sWsName, "Monthly")

Am I missing something?
 
Back
Top