NumberFormat Property

Microsoft Office Web Components Visual Basic

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.

Remarks

You can define a number format by using the same format codes as Microsoft Excel. For information on number format codes, see the "Create or delete a custom number format" topic in Microsoft Excel Help.

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