• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting in Excel -> search different words in column and color them
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Scripting in Excel -> search different words in column and color them (From: Bjorn Van Blanckenberg <email@hidden>)

  • Prev by Date: Re: Scripting in Excel -> search different words in column and color them
  • Next by Date: Re: Scripting Excel to go to the next row
  • Previous by thread: Scripting in Excel -> search different words in column and color them
  • Next by thread: Re: Scripting in Excel -> search different words in column and color them
  • Index(es):
    • Date
    • Thread