What are .NumberFormat Options In Excel VBA?

后端 未结 5 769
小鲜肉
小鲜肉 2020-11-27 12:45

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:

5条回答
  •  我在风中等你
    2020-11-27 13:24

    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)

提交回复
热议问题