LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 83
Default Check if variable contains a string

I'm trying to write VBA code that will look at a String variable and tell me
whether or not that String contains another String €” without erroring out.
Variable X contains this string: =SUM(AAAA,BBBB)
Variable Y contains this string: PPPP
I want something that works sort of like this:
If Variable X contains Variable Y, Then Variable W = 1
If Variable X does not contain Variable Y, Then Variable W = 2
In the example above, W will equal 2, since X does not contain Y
If Y is BBBB then W will equal 1, because X does contain Y
Many thanks.

 
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
Variable string$ Ferdy New Users to Excel 3 November 26th 08 08:45 PM
Use a string as a Variable Name Brandt Excel Worksheet Functions 4 November 28th 07 06:01 PM
find a variable text string [email protected] Excel Discussion (Misc queries) 2 January 30th 07 07:20 PM
calling variable within string [email protected] Excel Worksheet Functions 8 May 4th 06 03:07 PM
Variable in string DevinC Excel Discussion (Misc queries) 5 January 26th 06 08:59 PM


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

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

About Us

"It's about Microsoft Excel"