|
- Sub qs()
- Application.ScreenUpdating = False
- Dim ss, s, arr, ii, d2 As Object, tt, jj, k
- Dim ar, i, dic
- Set d2 = CreateObject("scripting.dictionary")
- arr = Sheet7.UsedRange.Value
- For ii = 2 To UBound(arr)
- ss = arr(ii, 1)
- If Len(ss) > 1 Then
- If Not d2.exists(ss) Then
- For jj = 20 To 26
- If arr(ii, jj) = Empty Then
- arr(ii, jj) = 0
- End If
- Next
- d2(ss) = Array(arr(ii, 20), arr(ii, 21), arr(ii, 22), arr(ii, 23), arr(ii, 24), arr(ii, 25), arr(ii, 26))
- End If
- End If
- Next
- br = [{"Y11","AD11","AI11","AN11","AS11","AX11","BC11"}]
- Set dic = CreateObject("scripting.dictionary")
- ar = [{"","*1";"困气1","*0.8";"困气2","*0.6";"困气3","*0.4";"困气4","*0.2";"困气5","*0.1";"冲气1","/0.8";"冲气2","/0.6";"冲气3","/0.4";"冲气4","/0.2";"冲气5","/0.1"}]
- For i = 1 To UBound(ar)
- dic(ar(i, 1)) = ar(i, 2)
- Next
- tt = Sheet1.[BQ7].Value
- k = d2(tt)
- For i = 1 To UBound(br)
- s = Sheet1.Range(br(i)).Value
- t = dic(s) '找出ar数组的系数
- Sheet1.Range(br(i)).Offset(-1).Value = Evaluate(k(i - 1) & t)
- Next
- Set dic = Nothing: Set d2 = Nothing
- Application.ScreenUpdating = True
- End Sub
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Not Intersect(Target, Me.Range("Y11:BC11,DZ9")) Is Nothing Then
- On Error Resume Next
- Application.EnableEvents = False
- Call qs
- Application.EnableEvents = True
- End If
- End Sub
复制代码 |
|