|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim crr() As Boolean
- Dim d As Object
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- With Worksheets("系统数据")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- brr = .Range("a2:m" & r)
- For i = 1 To UBound(brr)
- d(brr(i, 2)) = i
- If Len(brr(i, 13)) <> 0 Then
- xm = Split(brr(i, 13), ",")
- For j = 0 To UBound(xm)
- d1(xm(j)) = i
- Next
- End If
- Next
- End With
- With Worksheets("计费")
- r = .Cells(.Rows.Count, 3).End(xlUp).Row
- .Range("b5:b" & r & ",e5:e" & r & ",l5:m" & r).ClearContents
- .Range("c5:c" & r).Interior.ColorIndex = 0
- arr = .Range("a5:m" & r)
- ReDim crr(1 To UBound(arr), 1 To 1)
- For i = 1 To UBound(brr)
- If d.exists(arr(i, 3)) Then
- m = d(arr(i, 3))
- arr(i, 2) = brr(m, 1)
- arr(i, 5) = brr(m, 5)
- arr(i, 12) = brr(m, 13)
- ElseIf d1.exists(arr(i, 3)) Then
- m = d1(arr(i, 3))
- arr(i, 2) = brr(m, 1)
- arr(i, 5) = brr(m, 5)
- arr(i, 12) = brr(m, 13)
- arr(i, 13) = brr(m, 2)
- crr(i, 1) = True
- End If
- Next
- .Range("a5:m" & r) = arr
- For i = 1 To UBound(crr)
- If crr(i, 1) Then
- .Cells(i + 4, 3).Interior.ColorIndex = 6
- End If
- Next
- End With
- End Sub
复制代码 |
|