简体   繁体   English

NumberFormat 通过 Excel VBA

[英]NumberFormat through Excel VBA

I got to search and find similar issues on this, but not specifically on this我必须搜索并找到类似的问题,但不是专门针对这个

'Why this works:
Range("A2").NumberFormat = "[>999999]0,,\M;[>999]0,K;0"

'And not this:
Range("A2").NumberFormat = "[>999999999]0,,,B;[>999999]0,,\M;0"

What I am trying to accomplish is to have billions as "B" and millions as "M" (ideally all three with thousands as "K").我想要完成的是将数十亿作为“B”,将数百万作为“M”(理想情况下所有三个都以数千作为“K”)。 As always thanks for the help/explanations.一如既往地感谢您的帮助/解释。

Yes, thanks for the quick replies, I got it to work.是的,感谢您的快速回复,我得到了它的工作。 Backslashes are mandatory not just for reserve "M" letter反斜杠是强制性的,不仅仅是保留“M”字母

Range("A2").NumberFormat = "[>=1000000000]0,,,\B;[>=1000000]0,,\M;0,\K"

Thanks Rory谢谢罗里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM