LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default check to see if cell contains a string = to member of list

Hi
one way would be to combine some InStr statement with or functions.
e.g.

sub foo()
dim sname
sname=Activesheet.range("A1").value
if instr(sname, "school") or instr(sname,"college") or _
instr(sname,"university") then
msgbox "cell A1 contains one of your words"
else
'your code
end if
end sub



--
Regards
Frank Kabel
Frankfurt, Germany


NikkoW wrote:
I can't seem to find a reference to doing this. Perhaps someone could
help me.

I have a customer list that includes educational institutions. The
name may include the word "school" or "college" or "university" and a
bunch of others. I am using a macro to copy my customer list from one
worksheet to the next. If the cell containing the names of the
customers (column A) includes one of the above strings, I want to
skip on to the next row and not copy that row.

My initial thought was that there might be some function to check if
a cell contained any of my words (that had been defined as part of an
array, perhaps) but I can't seem to find an efficient way of doing
this.

Any suggestions?

Thanks again.


 
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 NON-presence of a string in another string G.P.N.L. c.v.a. Excel Worksheet Functions 4 December 11th 09 06:10 PM
how to I make member list that indicates when subs due Lozza Excel Worksheet Functions 2 January 17th 07 02:52 PM
Macro syntax to check string length in a cell El Bee Excel Discussion (Misc queries) 3 November 1st 06 09:13 PM
How do I put each member of string concatenation in its own line? DViolette Excel Worksheet Functions 3 July 8th 05 02:08 AM
Cell is a Member of a range or Not pgjoshi Excel Programming 3 March 6th 04 02:08 PM


All times are GMT +1. The time now is 11:22 PM.

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"