Specific Find in Applescript/Excel

Dear All,

I have a silly little problem which I am sure has an obvious answer.

I am doing a ‘find’ in an excel worksheet based on a previously established variable - which is a name. The problem is:

If the names are unique, but sometimes the contents of the names are not unique…

e.g. one name choice for the variable theNickname is ‘Ben’, and one name choice is ‘Ben & Bill’

If I do a standard search for ‘Ben’, then if ‘Ben and Bill’ comes first in the list, it will find this record instead.


set rangeToSearch to get range "C:C"
set fc to (find rangeToSearch what theNickname)

Can anyone tell me how to do a search that only finds the specific value of theNickname with no variation???

All the best,

DDHawk

arghh to excel :wink: but I guess it’s :

	set fc to (find rangeToSearch what theNickname look at whole)

find range
what Unicode text : The data to search for.
[after range object/A1-style range reference/named range/list of category names] : The cell after which you want to search. Note that after must be a single cell in the range. If this argument isn't specified, the search starts after the cell in the upper-left corner of the range.
[look in formulas/comments/values] : Specifies where the find method should look.
[b][look at part/whole] : Specifes the part that should be looked at.
[/b][search order by columns/by rows] : Specifies if the search should be rows or columns.
[search direction search next/search previous] : Specifies the search direction either next or previous.
[match case boolean] : Set to true to make the search case sensitive.
[match byte boolean] : Used only in the East Asian version of Microsoft Excel. Set to true to have double-byte characters match only double-byte characters. False to have double-byte characters match their single-byte equivalents.
→ range : The range which the specified data was found.

Dear Hans-Gerd,

Thank you very much. That does the job perfectly!!!

Excellent help!!

Happy New Year

DDHawk