格式化vba msgbox以显示具有两个小数字房屋的单元格

时间:2015-06-09 09:31:05

标签: excel vba

代码所指向的单元格(b2,b3 ..)已经显示2个小数,但msg框显示了很多。我该如何解决?我试过& _     格式(dTotalArea," 0.00"),但没有用。

非常感谢提前。

MsgBox "First Response Time (hours)= " & _
Worksheets("Results").Range("B2").Value & _
vbCrLf & "Investigation Time (hours)= " & _
Worksheets("Results").Range("B3").Value & _
vbCrLf & "Nr of Incidents Resolved= " & _
Worksheets("Results").Range("B4").Value & _
vbCrLf & "Resolved Same Day (%)= " & _
Worksheets("Results").Range("B5").Value & _
Format(dTotalArea, "0.00"), , "title_of_msgbox"

1 个答案:

答案 0 :(得分:0)

试试这个

MsgBox "First Response Time (hours)= " & _
Worksheets("Sheet1").Range("B2").Value & _
vbCrLf & "Investigation Time (hours)= " & _
Format(Worksheets("Sheet1").Range("B3").Value, "0.00") & _
vbCrLf & "Nr of Incidents Resolved= " & _
Format(Worksheets("Sheet1").Range("B4").Value, "0.00") & _
vbCrLf & "Resolved Same Day (%)= " & _
Format(Worksheets("Sheet1").Range("B5").Value, "0.00") _
, , "title_of_msgbox"