View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Storing text in an array

Sub Tester2()
Dim blnCommon As Boolean
Dim searchTerm As String
Dim myCommon As Variant
searchTerm = "Company"
myCommon = Array("American", "Company", "Corporation", "Ltd", "Inc")

blnCommon = Not (IsError(Application.Match(searchTerm, myCommon, 0)))
MsgBox blnCommon


End Sub


--
Regards,
Tom Ogilvy


"Daniel Bonallack" wrote in
message ...
I have a simple macro that maps one list of company names against another,
such that small differences are ignored.

For example, American Packaging Corp would return a match (using this

macro)
with American Packaging Inc

I want to improve its accuracy, and to do this I want to store 200

"common"
words in an array, then test to see if a word is contained in this array.

For example:
myCommon = {"American", "Company", "Corporation", "Ltd", "Inc"...)

blnCommon = True if a word exists in the array, and blnCommon = False if

it
isn't in the array. This is the line of code that isn't working for me.

If I can get help with just this line of code, then I can muddle on from
there.

Thanks
Daniel