Function ProtectiveDiscount(PDD As Range)
'‘Find discount in table
TotalDiscount = 0
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i).Value = "Dead bolt, Local Fire Alarm, Fire extinguisher" Then
Msg = Msg & ListBox1.List(i) & vbNewLine
TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Worksheets("Sheet4").Range("PDD"), 2, False)
' TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Range("R50:S55"), 2, False)
End If
If ListBox1.Selected(i).Value = "Burglar Alarm with Reporting" Then
Msg = Msg & ListBox1.List(i) & vbNewLine
TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, PDD, 2, False)
' TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Range("R50:S55"), 2, False)
End If
If ListBox1.Selected(i).Value = "Fire Alarm with Reporting" Then
Msg = Msg & ListBox1.List(i) & vbNewLine
TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Worksheets("Sheet4").Range("PDD"), 2, False)
'TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Range("R50:S55"), 2, False)
End If
If ListBox1.Selected(i).Value = "Automatic Sprinkler in all areas" Then
Msg = Msg & ListBox1.List(i) & vbNewLine
TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Worksheets("Sheet4").Range("PDD"), 2, False)
' TotalDiscount = TotalDiscount + WorksheetFunction.VLookup(ListBox1.Selected(i).Value, Range("R50:S55"), 2, False)
End If
End Function
由于某种原因,我的 vlookup 功能不起作用。我尝试了几种方法,但我被卡住了。任何人都可以提供任何帮助