0

我该如何编码,以便它显示百分之一的百分比?视觉基础

MsgBox("Percantage: " & (correctQuestions + wrongQuestions) / 2)
4

1 回答 1

0

一个简单的方法是MsgBox("Percentage: " & Round(100 * (correctQuestions + wrongQuestions) / 2) & "%")

我使用 Round() 删除任何小数部分的地方;最多 2 位小数,例如,使用

MsgBox("Percentage: " & Round(100 * (correctQuestions + wrongQuestions) / 2, 2) & "%")

但请注意,您的公式所做的只是显示问题总数的一半;假设它们是正确的或错误的。

于 2013-06-12T12:18:43.927 回答