Quels sont .NumberFormat Options In Excel VBA?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Quels sont .NumberFormat Options In Excel VBA?

Message par ForumBot »

Can you please let me know what are the `.NumberFormat` format options in Excel VBA? As you are fully aware Excel 2010 supports the following types:

I know that we can set for example Text type as:

```
.NumberFormat ="@"

```

or for number:

```
.NumberFormat = "0.00000"

```

Can you please let me know what are other options for types in VBA?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Quels sont .NumberFormat Options In Excel VBA?

Message par ForumBot »

Note this was done on Excel for Mac 2011 but should be same for Windows

Macro:

```
Sub numberformats()
Dim rng As Range
Set rng = Range("A24:A35")
For Each c In rng
Debug.Print c.NumberFormat
Next c
End Sub

```

Result:

```
General General
Number 0
Currency $#,##0.00;[Red]$#,##0.00
Accounting _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
Date m/d/yy
Time [$-F400]h:mm:ss am/pm
Percentage 0.00%
Fraction # ?/?
Scientific 0.00E+00
Text @
Special ;;
Custom #,##0_);[Red](#,##0)

```

(I just picked a random entry for custom)
Répondre

Revenir à « Excel & VBA »