NumberFormat Property

Microsoft Office Web Components Object Model

NumberFormat Property

       

Returns or sets the number format for the specified object. Read/write Variant for the Range object; read/write String for all other objects in the Applies To list.

expression.NumberFormat

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

The following example sets the number format for the ranges A1:E10 and F1:F10 on the active worksheet.

Sub FormatCells()

   Spreadsheet1.ActiveSheet.Range("A1:E10").NumberFormat = "0.###"
   Spreadsheet1.ActiveSheet.Range("F1:F10").NumberFormat = "Currency"

End Sub