我正在尝试将计算的返回值粘贴到选定的单元格中,但是,消息框中的返回值与粘贴到单元格中的值不同。为什么是这样?
Sub CalcmsgboxAcre()
On Error Resume Next
Dim num As Double
num = Application.InputBox(prompt:="Please Enter The Number Of Hectares You Would Like To Calculate Into Acres ", Type:=1)
MsgBox Format(num * 2.471054, "#,##0.00") & " Is the Number Of Acre's."
num = MsgBox("Do you want to paste the result in a cell?", vbYesNo)
If num = vbYes Then
cell = Application.InputBox("Type In The Cell Reference")
Range(cell).Value = num * 2.471054
End If
End Sub
答案 0 :(得分:1)
您正在为num:
指定一个新值num = MsgBox (...)
所以vbYes
乘以因子然后进入单元格。