ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   case is string contains string? (https://www.excelbanter.com/excel-programming/440903-case-string-contains-string.html)

salgud

case is string contains string?
 
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!

Don Guillett[_2_]

case is string contains string?
 
Look in the vba help index for
INSTR

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"salgud" wrote in message
...
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!



Gary Keramidas[_4_]

case is string contains string?
 
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


--


Gary Keramidas
Excel 2003


"salgud" wrote in message
...
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!



Bob Phillips[_4_]

case is string contains string?
 
Try

Select Case True

Case string1 Like "*string2*"

etc.
End Select

--

HTH

Bob

"salgud" wrote in message
...
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!




salgud

case is string contains string?
 
On Mon, 22 Mar 2010 16:29:40 -0600, salgud wrote:

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!

salgud

case is string contains string?
 
On Tue, 23 Mar 2010 07:38:15 -0600, salgud wrote:

On Mon, 22 Mar 2010 16:29:40 -0600, salgud wrote:

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!


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?

Bob Phillips[_4_]

case is string contains string?
 
Not much point us answering if you don't read it

Case sWsName like "*Monthly*"


--

HTH

Bob

"salgud" wrote in message
...
On Tue, 23 Mar 2010 07:38:15 -0600, salgud wrote:

On Mon, 22 Mar 2010 16:29:40 -0600, salgud wrote:

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!


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?




salgud

case is string contains string?
 
On Tue, 23 Mar 2010 19:19:10 -0000, Bob Phillips wrote:

Not much point us answering if you don't read it

Case sWsName like "*Monthly*"


Thanks for your help.


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com