What are .NumberFormat Options In Excel VBA?

后端 未结 5 766
小鲜肉
小鲜肉 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 13:25

    dovers gives us his great answer and based on it you can try use it like

    public static class CellDataFormat
    {
            public static string General { get { return "General"; } }
            public static string Number { get { return "0"; } }
    
            // Your custom format 
            public static string NumberDotTwoDigits { get { return "0.00"; } }
    
            public static string Currency { get { return "$#,##0.00;[Red]$#,##0.00"; } }
            public static string Accounting { get { return "_($* #,##0.00_);_($* (#,##0.00);_($* \" - \"??_);_(@_)"; } }
            public static string Date { get { return "m/d/yy"; } }
            public static string Time { get { return "[$-F400] h:mm:ss am/pm"; } }
            public static string Percentage { get { return "0.00%"; } }
            public static string Fraction { get { return "# ?/?"; } }
            public static string Scientific { get { return "0.00E+00"; } }
            public static string Text { get { return "@"; } }
            public static string Special { get { return ";;"; } }
            public static string Custom { get { return "#,##0_);[Red](#,##0)"; } }
    }
    

提交回复
热议问题