|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Dim ws As Worksheet
- Set d = CreateObject("scripting.dictionary")
- s = 0
- For Each ws In Worksheets
- If ws.Name Like "#*表" Then
- With ws
- r = .Cells(.Rows.Count, 3).End(xlUp).Row
- arr = .Range("a7:d" & r)
- For i = 1 To UBound(arr)
- If Len(arr(i, 2)) = 0 Then
- xm = arr(i, 3)
- Else
- If Not d.exists(xm) Then
- Set d(xm) = CreateObject("scripting.dictionary")
- End If
- If Not d(xm).exists(arr(i, 3)) Then
- s = s + 1
- ReDim brr(1 To 3)
- brr(1) = xm
- brr(2) = arr(i, 3)
- brr(3) = arr(i, 4)
- d(xm)(arr(i, 3)) = brr
- End If
- End If
- Next
-
- End With
- End If
- Next
- ReDim crr(1 To s, 1 To 3)
- m = 0
- For Each aa In d.keys
- For Each bb In d(aa).keys
- brr = d(aa)(bb)
- m = m + 1
- For j = 1 To UBound(brr)
- crr(m, j) = brr(j)
- Next
- Next
- Next
- With Worksheets("数据处理表")
- .Range("c6:e" & .Rows.Count).ClearContents
- With .Range("c6").Resize(UBound(crr), UBound(crr, 2))
- .Value = crr
- .Borders.LineStyle = xlContinuous
- With .Font
- .Name = "微软雅黑"
- .Size = 10
- End With
- End With
- With .Range("c6:c" & UBound(crr) + 5 & ",e6:e" & UBound(crr) + 5)
- .HorizontalAlignment = xlCenter
- End With
- With .Range("d6:d" & UBound(crr) + 5)
- .HorizontalAlignment = xlLeft
- End With
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|