By the way, you can remove the tell/end tell statements around the set column width…
commands as they are already inside an excel tell block.
As for text alignment, horizontal alignment is a property of ‘range
’ and of ‘cell
’.
The command would like like this:
set horizontal alignment of range "C4:D4" to horizontal align center
--> horizontal align center
If you get the properties of a range, you can see that among them is the horizontal alignment.
As an aside, if you just run this command and look at the result in Script Editor, you will see that some of the property values are purple and some are blue. The purple values also possess their own properties, although not every one of them does. For example, horizontal align center has itself as a property.
But for many of them, especially those with ‘object’ in their name, you can dig up a lot of additional properties.
properties of range "C4:D4"
{class:range, add indent:false, ¬
areas:{range "[Workbook1]Sheet1!$C$4:$D$4" of application "Microsoft Excel"}, first column index:3, ¬
column width:10.0, current array:missing value, ¬
current region:current region of range "C4:D4" of application "Microsoft Excel", ¬
dependents:missing value, direct dependents:missing value, direct precedents:missing value, ¬
entire column:entire column of range "C4:D4" of application "Microsoft Excel", ¬
entire row:entire row of range "C4:D4" of application "Microsoft Excel", ¬
font object:font object of range "C4:D4" of application "Microsoft Excel", formula:{{"3", "4"}}, ¬
formula array:missing value, formula label:missing value, formula hidden:false, ¬
formula local:{{"3", "4"}}, formula r1c1:{{"3", "4"}}, formula r1c1 local:{{"3", "4"}}, ¬
has array:false, has formula:false, height:15.0, hidden:missing value, ¬
horizontal alignment:horizontal align general, ¬
indent level:0, interior object:interior object of range "C4:D4" of application "Microsoft Excel", ¬
left position:130.0, list header rows:0, location in table:missing value, locked:true, ¬
merge area:missing value, merge cells:false, name:missing value, named item:missing value, ¬
number format:"General", number format local:"General", text orientation:orientation horizontal, ¬
outline level:missing value, page break:missing value, pivot field:missing value, pivot item:missing value, pivot table:missing value, precedents:missing value, ¬
prefix character:"", query table:missing value, first row index:4, row height:15.0, ¬
show detail:missing value, shrink to fit:false, style object:style object of range "C4:D4" of application "Microsoft Excel", ¬
summary:missing value, string value:{{"3", "4"}}, top:45.0, use standard height:true, ¬
use standard width:true, validation:validation of range "C4:D4" of application "Microsoft Excel", ¬
value:{{3.0, 4.0}}, value2:{{3.0, 4.0}}, vertical alignment:vertical alignment bottom, ¬
width:130.0, worksheet object:worksheet object of range "C4:D4" of application "Microsoft Excel", ¬
wrap text:false, Excel comment:missing value, phonetic object:phonetic object of range "C4:D4" of application "Microsoft Excel", ¬
reading order:left to right, list object:missing value, count large:2, ¬
display format:display format of range "C4:D4" of application "Microsoft Excel"} ¬