2016-06-14 25 views
0

我需要將用戶在兩個輸入框中輸入的兩個數字相除。放在第一個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 

回答

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 
相關問題