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 関数が機能しません。いくつかの方法を試しましたが、行き詰っています。誰でも助けてもらえますか