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: Craig Treleaven <email@hidden>
- Date: Wed, 23 Oct 2002 21:46:45 -0400
>
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
>
>
Thanks
>
Bjorn Van Blanckenberg
The following stops on the first cell containing the target text and does what you suggested.
tell application "Microsoft Excel"
set searchRange to Range "R1C1:R65535C5"
set foundRange to Find searchRange What "BlahBlahBlah"
set Bold of Font of foundRange to true
set ColorIndex of Font of foundRange to 3
end tell
I think there is a way to use named colours* but I can't remember right now. Which brings up a good point.
If you can't figure out the AppleScript commands to do what you want, use the built-in VBA recorder in Excel to get some hints. For example, I recorded a simple VBA macro that bolded a cell and set the text colour to red. The guts of it are:
Range("A2").Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
From this, I noticed that Bold is a True/False toggle and the "ColorIndex" attribute and the value of 3 for red.
Craig
*Canadian spelling, eh!
Craig Treleaven, CA -- Clearview Consulting
(905) 829-2054 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.