如何使用两个输入框中的两个用户输入并将它们分开

时间:2016-06-14 19:58:34

标签: excel vba excel-vba

我需要将用户输入的两个数字除以两个InputBox。放在第一个InputBox中的数字是成本,第二个InputBox中放置的数字是权重。我需要将这两个数字分开来给我单位价格。

    If response = vbNo Then
      retval = InputBox("Please Enter PO Cost")
        Number_1 = "InputBoxValue"

    retval = InputBox("Please Enter Net Weight")
        Number_2 = "InputBoxValue"

    Answer = Number_2 / Number_1

1 个答案:

答案 0 :(得分:0)

Cost / Weight会给你单位价格:

Sub Demo()
    Dim cost, weight, answer As Variant

    cost = InputBox("Please Enter PO Cost")
    weight = InputBox("Please Enter Net Weight")
    answer = cost / weight
    MsgBox "Price per Unit is: " & answer
End Sub