Re: Scripting in Excel -> search different words in column and color them
Re: Scripting in Excel -> search different words in column and color them
- Subject: Re: Scripting in Excel -> search different words in column and color them
- From: Kai Edwards <email@hidden>
- Date: Thu, 24 Oct 2002 01:40:04 +0000
on Wed, 23 Oct 2002 16:12:35 +0200, Bjorn Van Blanckenberg <email@hidden>
wrote:
>
I want to search in 5 columns the word "missing" or "FALSE" or "empty" and
>
if it is found color it red and set the font to bold
>
>
Could somebody point me in the right direction
This isn't particularly fast, but it does what you seem to be describing:
----------------------------------
tell application "Microsoft Excel"
Activate -- if required
set searchRange to Range "C1:C5" -- or any required range
repeat with findVal in {"missing", "FALSE", "empty"}
repeat 1 times
try
set startCell to Find searchRange What findVal [NO BREAK]
LookIn xlValues LookAt xlWhole with MatchCase
on error number -1708 -- findVal not found
exit repeat
end try
set currCell to startCell
repeat
set {currCell's Font's Bold, currCell's Font's ColorIndex, [NO BREAK]
currCell} to {true, 3, FindNext searchRange after currCell}
if currCell = startCell then exit repeat
end repeat
end repeat
end repeat
end tell
----------------------------------
You may have to change the value of the variable 'ColorIndex' (set above as
3), depending on Excel's current color preferences.
HTH
Kai
--
email@hidden
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.