Sub PctTest()
Dim Third As Variant
Third = 1 / 3
MsgBox (Third)
End Sub
如何让msgbox将变量“Third”显示为33.33%?我知道如何格式化单元格,但我已经环顾四周,不明白如何格式化这样的变量。提前谢谢 - 汤米
答案 0 :(得分:0)
怎么样:
Dim Third As Variant
Third = Format(1 / 3, "##.00%")
MsgBox (Third)
答案 1 :(得分:0)
您可以使用内置:FormatPercent(1 / 3, 2)