0
Sub PctTest()
   Dim Third As Variant
   Third = 1 / 3    
   MsgBox (Third)
End Sub

如何让 msgbox 将变量“Third”显示为 33.33%?我知道如何格式化单元格,但我环顾四周,不明白如何格式化这样的变量。在此先感谢-汤米

4

2 回答 2

0

怎么样:

   Dim Third As Variant
   Third = Format(1 / 3, "##.00%")
   MsgBox (Third)
于 2012-06-28T15:42:05.057 回答
0

您可以使用内置的:FormatPercent(1 / 3, 2)

于 2012-06-28T16:46:48.487 回答