Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default 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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default 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!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default 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!


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default 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?
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default 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?



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default 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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check for case of string msnyc07 Excel Worksheet Functions 3 February 18th 10 12:11 AM
Checking if a cell contains a string that is not case sensitive Colin Hempsey Excel Programming 3 May 9th 08 05:41 PM
Select Case Not Returning Correct String RyanH Excel Programming 3 February 15th 08 03:03 PM
Passing a string to Case statement Beertje Excel Programming 4 October 4th 07 03:45 PM
Question about comparing mixed case string values TBA[_2_] Excel Programming 4 January 17th 04 06:32 PM


All times are GMT +1. The time now is 01:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"