The Number Format property

The NumberFormat property represents the number format (expressed as a text string) of the Range object. This is a read-write property, so your VBA code can change the number format. The following statement changes the number format of column A to percent with two decimal places:

Columns("A:A").NumberFormat = "0.00%"

Follow these steps to see a list of other number formats:

1. Activate a worksheet.

2. Access the Format Cells dialog box by pressing Ctrl+1.

3. Click the Number tab.

4. Select the Custom category to view some additional number format strings.

0 0

Post a comment