Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.41 KB

Excel.Range.NumberFormat.md

File metadata and controls

44 lines (29 loc) · 1.41 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Range.NumberFormat property (Excel)
vbaxl10.chm144167
vbaxl10.chm144167
Excel.Range.NumberFormat
351247d2-e4b9-64a0-6dbe-0df535fa701c
05/11/2019
high

Range.NumberFormat property (Excel)

Returns or sets a Variant value that represents the format code for the object.

Syntax

expression.NumberFormat

expression A variable that represents a Range object.

Remarks

This property returns Null if all cells in the specified range don't have the same number format.

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

For more information, see Number format codes (Microsoft Support).

Example

These examples set the number format for cell A17, row one, and column C (respectively) on Sheet1.

Worksheets("Sheet1").Range("A17").NumberFormat = "General" 
Worksheets("Sheet1").Rows(1).NumberFormat = "hh:mm:ss" 
Worksheets("Sheet1").Columns("C"). _ 
 NumberFormat = "$#,##0.00_);[Red]($#,##0.00)"

[!includeSupport and feedback]