0

我当前的计算,将值返回到 msgbox。

我想要一个进一步的 msgbox 询问“你想粘贴值吗”,然后能够选择一个单元格来粘贴值。

我不知道如何保留计算结果以便能够粘贴它。

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."
End Sub
4

1 回答 1

0

您不需要保存结果,在显示结果后您只需要询问用户是否希望通过执行保存它

Save = MsgBox("Do you want to paste the result in a cell?", vbYesNo)

然后,如果答案是肯定的,您需要询问单元格并将结果粘贴到那里

If Save = vbYes Then
    cell = Application.InputBox("In which cell")
    Range(cell).Value = num * 2.471054
End If

希望这会有所帮助,布鲁诺

于 2013-05-26T00:54:26.027 回答