office交流网--QQ交流群号

Access培训群:792054000         Excel免费交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

VBA设置单元格的格式

2020-05-16 08:00:00
zstmtony
原创
3482

VBA设置单元格的格式

Sub 设置格式()


    [a1].NumberFormatLocal = "@" '设置A1单元格为文本格式
    [b1].NumberFormatLocal = "yyyy/m/d" '设置B1单元格为日期格式
    [c1].NumberFormatLocal = "[$-F400]h:mm:ss AM/PM" '设置C1单元格为时间格式
    [d1].NumberFormatLocal = "0.00%" '设置D1单元格为百分比格式
    [e1].NumberFormatLocal = "0.00E+00" '设置E1单元格为科道学记数法格式

    [f1].NumberFormatLocal = "G/通用格式" '设置F1单元格为常规格式

    [g1].NumberFormatLocal = "[DBNum2][$-804]G/通用格式元整" '人民币大写


End Sub
分享