|
- Sub 汇总()
- Dim dic As Object, dic1 As Object
- Dim ii%, jj%, nn%
- Dim hz, crr()
- Set dic = CreateObject("scripting.dictionary")
- Set dic1 = CreateObject("scripting.dictionary")
- For ii = 1 To UBound(brr, 2)
- dic(brr(2, ii)) = brr(6, ii)
- Next
- With Sheet4
- hz = .Range(.[o4], .[r65536].End(3)(2, 1))
- End With
- For ii = 1 To UBound(hz)
- dic1(hz(ii, 2)) = ""
- If dic.exists(hz(ii, 2)) Then hz(ii, 4) = hz(ii, 4) + dic(hz(ii, 2))
- Next
- For jj = 1 To UBound(brr, 2)
- If Not dic1.exists(brr(2, jj)) Then
- nn = nn + 1
- ReDim Preserve crr(1 To 4, 1 To nn)
- If hz(1, 1) = "" Then crr(1, nn) = nn Else crr(1, nn) = UBound(hz) + nn
- crr(2, nn) = brr(2, jj): crr(3, nn) = brr(3, jj): crr(4, nn) = brr(6, jj)
- End If
- Next
- With Sheet4
- .Range(.[o4], .[r65536].End(3)(2, 1)).ClearContents
- .[o4].Resize(UBound(hz), 4) = hz
- If nn > 0 Then .[o65536].End(3)(2, 1).Resize(nn, 4) = Application.Transpose(crr)
- End With
- End Sub
复制代码 |
|