2016-06-21 7 views
0

PercentRank関数を使用すると、メッセージボックスに数値が「0.00」の数値形式で出力されます。それを変える方法はありますか?好ましくは、それが "00%" のように出てくるPercentRank関数出力の数値書式を変更します。

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 

答えて

1

あなたはVBAのFormat functionを試してみましたか?

If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & Format(x, "00%") 
0

また

If x > 0.7 Then MsgBox "WARNING: Price is more than 20% above the average price: " & Round(x*100,0) & ''%'' 
...これを試すことができます
関連する問題