以下是我的代码中有问题的部分。代码通过InputBox接收ProductCode和Quantity,但是,一旦输入ProductcCode,我也希望它定义存储值," Cost"和"折扣"旁边是它们,所以它们可以显示在我的最终输入框中。任何帮助将不胜感激。
'Obtaining VLookup Value
ProductCode = InputBox("Enter the ProductCode's code.")
'Error checking
Do Until ErrorCheck = False
If ProductCode = "" Then
ErrorCheck = True
MsgBox ("Not a valid entry.")
ProductCode = InputBox("Enter the ProductCode's code.")
Cost = ActiveCell.Offset(0, 1).Select
MinQty = ActiveCell.Offset(0, 2).Value
Discount = ActiveCell.Offset(0, 3).Value
ElseIf IsError(Application.VLookup(ProductCode, myRange, 3, False)) Then
ErrorCheck = True
MsgBox ("The value entered was not found.")
ProductCode = InputBox("Enter the ProductCode's code.")
Else
ErrorCheck = False
End If
Loop
答案 0 :(得分:0)
你的叙述不是很清楚,也与你的部分代码冲突,但我认为O得到了全部的想法
因此您可以尝试调整此(注释)代码
.bat