当我使用PercentRank功能时,消息框会在" 0.00"中显示数字。数字格式。有什么方法可以改变吗?最好是以" 00%"
x = WorksheetFunction.PercentRank(relevant_Array, answer, 2)
If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & x
If x < 0.3 Then MsgBox "WARNING: Price is more than 20% below the average price: " & x
If x > 0.3 And x < 0.7 Then MsgBox "Carry on: your price seems to be accurate: " & x
答案 0 :(得分:1)
你有没有试过VBA&#39; Format function?
If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & Format(x, "00%")
答案 1 :(得分:0)
你也可以试试这个......
If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & Round(x*100,0) & ''%''