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