Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
编写了一个输出数字的 VBA 脚本,我认为我有正确的千位分隔格式字符串(4,656,565 5,343 232,434 等),但它不适用于特定数量的数字。
到目前为止,我正在使用Cells(x,y).NumberFormat = "#,###"
Cells(x,y).NumberFormat = "#,###"
有人可以为我提供正确的格式字符串来以千位逗号分隔任何数字,无论大小如何?
这对我有用。请注意,先格式化单元格,然后再为其分配数字
Option Explicit Sub Sample() With Cells(1, 1) .NumberFormat = "#,##0" .Value = 4.65656553432324E+16 '46565655343232400 End With End Sub
结果
单元格 A1 有46,565,655,343,232,400
46,565,655,343,232,400