3.7.5.102.40 wks.col.setformat

Syntax

wks.col.setformat(format[, subformat , customFormat])

Description

Setformat method combines functionalities of the format and subformat methods, additionally allowing custom formats to be specified. This object method takes up to 3 arguments, See wks.col.format and wks.col.subformat properties. Only set subformat and customformat if format is 4 (date)

wks.col.setformat(2) //set to text
wks.col.setformat(2) //set to date using system date format
wks.col.setformat(4,10) //set to date using 11th built-in date format
wks.col.setformat(4, 22, dd-MMM-yyyy HH:mm:ss.###) //set to date using custom date format

Examples

This example sets the format of column 2 of the active worksheet to a custom date format.
// Surround non-date characters in specifier by single quotes:
wks.col2.SetFormat(4, 22, yyyy'.'MM'.'dd);

Note that all non-date characters included in the custom string specifier must be surrounded by single quotes.

Dates entered into this column will now be displayed in the specified custom format. Enter 07-29-09 into one or more cells and confirm the display to show 2009.07.29.

See also

wks.col.format, wks.col.subformat