This “FormatCell” AppleWorks script sets the format of a specified cell according to a range of possible parameters. It facilitates conditional formatting on cells.



See the scripts page for general installation and usage information.

by Neil Taylor


This script was not developed by BareFeetWare. Contact the author directly with any questions and feedback.



Download the script from here.


FormatCell sets the format of a specified cell according to a range of possible parameters. While it is unconditional itself, it is designed to make it possible to do conditional formatting on cells, by incorporating it into a condition.

FormatCell will apply one of various specified formats to a chosen cell.

The Macro takes the form:-

MACRO(“FormatCell”,2,”function”,”target cell”,parameters,...)

“target cell” is a text item containing the reference of the cell whose format you want to change. eg “A1”

There are several available functions and these have different parameter sets depending on the respective requirements.

Function Parameters Description
"setcolor" R, G, B Sets the target cell text to the color specified by the Red, Green & Blue colour parameters. eg 0,0,0 = black
"setpaper" R, G, B Sets the cell background to the colour specified by the Red, Green & Blue colour parameters. e.g. 65000,0,0 = red
"setcolorlike" ReferenceCell Sets the cell text and background colours to be the same as those in the Reference Cell.
"setborder" "TBLR" Adds borders to the cells for whichever letters are specified (of Top, Bottom, Left, Right). E.g. "TB" for Top and Bottom borders. Note that lower case letters should switch the borders off (e.g. "tblr") but they currently switch on due to an AW bug.
"setfont" "Fontname" Sets the font to that named (must be exact, including capitalization).
"setfontsize" pointsize Sets the pointsize of the cell to that specified. Can be a numeric value or a formula returning a numeric value.
"setstyle" "style1,2, etc..." (not currently implemented due to a bug in AppleWorks 5.0) Once implemented, this will set on those styles requested in the parameter. Note that the parameter is a single string with requests separated by commas). e.g. "Plain Text,Bold,Outline".

All functions return 1 if successful. (No special reason, but I had to return something).


= If the contents of cell A1 are > 500 set the color of A1 to Red else set the color of A1 to Black

The setstyle function has not been implemented due to a bug in AppleWorks 5.0. If 6.0 is ever good enough to justify the upgrade, I’ll fix this.

When the MACRO is first entered the results do not show up until the target cell is recalculated, either by amending that cell or by doing a full recalculate.

The macro does not work in imbedded spreadsheets.

This script works with AppleWorks 5. It has not been tested with AppleWorks 6.

© 2000 BareFeetWare