Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 如何使单元格内容显示在msgbox的消息中_Excel_Cell_Msgbox_Vba - Fatal编程技术网

Excel 如何使单元格内容显示在msgbox的消息中

Excel 如何使单元格内容显示在msgbox的消息中,excel,cell,msgbox,vba,Excel,Cell,Msgbox,Vba,我正在尝试开发一个MsgBox,它在从单元格引用馈送的MsgBox中显示一个问题 因此,在下面的示例中,消息“请输入公顷数”,我想从say工作表1单元格A1中提取 Sub ComplainceQuestion() On Error Resume Next Dim num As Double Dim Save num = Application.InputBox(prompt:="Please Enter The Number Of Hectares", Type:

我正在尝试开发一个
MsgBox
,它在从单元格引用馈送的
MsgBox
中显示一个问题

因此,在下面的示例中,消息“请输入公顷数”,我想从say
工作表1单元格A1
中提取

Sub ComplainceQuestion()
    On Error Resume Next
    Dim num As Double
    Dim Save
    num = Application.InputBox(prompt:="Please Enter The Number Of Hectares", Type:=1)
        MsgBox Format(num * 2.47105, "#,##0.00") & " Is the Number Of Acre's."
        Save = MsgBox("Do you want to paste the result in a cell?", vbYesNo)
        If Save = vbYes Then
            Cell = Application.InputBox("Type In The Cell Reference, for example 'G64'")
            Range(Cell).Value = num * 2.471054
        End If
End Sub

在原始代码中,num被指定为用户输入的值。要为其指定单元格的值,如A1,只需更改行num=Application.Inputbox。。。to num=范围(“A1”).值。修改代码:

Sub ComplainceQuestion()
On Error Resume Next
Dim num As Double
Dim Save
    num = Range("A1").Value
    MsgBox Format(num * 2.47105, "#,##0.00") & " Is the Number Of Acre's."
    Save = MsgBox("Do you want to paste the result in a cell?", vbYesNo)
    If Save = vbYes Then
        Cell = Application.InputBox("Type In The Cell Reference, for example 'G64'")
        Range(Cell).Value = num * 2.471054
    End If
    End Sub
编辑:将前面提到的行更改为
num=Application.InputBox(提示符:=Range(“A1”)。值,类型:=1)

在原始代码中,num被指定为用户输入的值。要为其指定单元格的值,如A1,只需更改行num=Application.Inputbox。。。to num=范围(“A1”).值。修改代码:

Sub ComplainceQuestion()
On Error Resume Next
Dim num As Double
Dim Save
    num = Range("A1").Value
    MsgBox Format(num * 2.47105, "#,##0.00") & " Is the Number Of Acre's."
    Save = MsgBox("Do you want to paste the result in a cell?", vbYesNo)
    If Save = vbYes Then
        Cell = Application.InputBox("Type In The Cell Reference, for example 'G64'")
        Range(Cell).Value = num * 2.471054
    End If
    End Sub
编辑:将前面提到的行更改为
num=Application.InputBox(提示符:=Range(“A1”).Value,类型:=1)

我仍然希望显示带有问题的输入框。我希望从单元格中提取输入框消息,而不是用于计算的值。谢谢,我仍然想显示输入框,并提出一个问题。我希望从单元格中提取输入框消息,而不是用于计算的值。谢谢