|
- Sub aa()
- On Error Resume Next
- Dim arr, brr, d As Object
- Dim mrr, nrr
- Sheet2.Activate
- mrr = [a2:b168]
- ReDim nrr(1 To UBound(mrr), 1 To 1)
- Set d = CreateObject("scripting.dictionary")
- arr = Sheet1.[a1:a19]
- brr = Sheet1.[b1:n19]
- crr = Application.Index(brr, 1, 0)
- For i = 2 To UBound(arr) '牌号所在的行数
- d(arr(i, 1)) = i
- Next
- For i = 1 To UBound(mrr)
- s1 = 0: s2 = 0
- x = d(mrr(i, 1))
- y = Split(mrr(i, 2), "*")
- drr = Application.Index(brr, x, 0)
- s1 = Application.WorksheetFunction.Lookup(Val(y(0)), crr, drr) '
- Select Case Val(y(1))
- Case Is < 1000
- s2 = 300
- Case 1000 To 1200 - 0.0001
- s2 = 150
- Case 1350 + 0.0001 To 1650
- s2 = -50
- Case 1200 To 1350
- s2 = 0
- Case 1650 + 0.0001 To 1800 - 0.0001
- s2 = 50
- Case Is >= 1800
- s2 = 100
- End Select
- nrr(i, 1) = IIf(s1 + s2 > 1000, s1 + s2, "")
- 100:
- Next
- Range("c2").Resize(UBound(nrr)) = nrr
- End Sub
复制代码 |
|