我一直收到错误消息“无法获取worksheetfunction类的vlookup属性”。 inputBox要求用户输入型号,然后输入零售或教育价格的状态“ 2”或“ 3”,vLookup应该根据用户输入的内容查找价格。 A5:A15是型号#,B5:B15是零售价,C5:C15是教育价。 价目表范围为A5:A15
Dim strModel As String
Dim strStatus As String
Dim shtComputers As Worksheet
Dim curPrice As Currency
Set shtComputers = Application.Workbooks("T6-EX-
E3D.xlsm").Worksheets("computers")
shtComputers.Unprotect
strModel = InputBox("Enter Model #: ", Default:="C100")
strStatus = InputBox("Enter status, 2 for retail or 3 for educational: ", Default:="2")
Range("Model") = strModel
Range("Status") = strStatus
curPrice = Application.WorksheetFunction.VLookup(strModel,Range("PriceList"), strStatus, False)
Range("Price").Value = curPrice