|
参与一下吧。- Sub ykcbf() '//2024.6.27
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- Set sh = ThisWorkbook.Sheets("汇总")
- n = 6
- ReDim brr(1 To 10000, 1 To 100)
- ReDim zrr(1 To 1, 1 To 100)
- For Each sht In Sheets
- If InStr(sht.Name, "#") Then
- With sht
- arr = .UsedRange
- bm = arr(1, 2)
- d1(bm) = d1(bm) + 1
- If Not d.exists(bm) Then
- c = c + 2
- d(bm) = c
- zrr(1, c - 1) = bm
- End If
- End With
- c = d(bm)
- k = d1(bm)
- For i = 3 To UBound(arr)
- If arr(i, 2) <> Empty Then
- s = arr(i, 2) & "|" & arr(i, 7) & "|" & k
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- End If
- r = d(arr(i, 2) & "|" & arr(i, 7) & "|" & k)
- For j = 2 To 7
- brr(r, j - 1) = arr(i, j)
- Next
- brr(r, n + c - 1) = arr(i, 8)
- brr(r, n + c) = arr(i, 9)
- End If
- Next
- End If
- Next
- With sh
- .Cells.UnMerge
- .[h2:z10000].ClearContents
- .[b3:g10000].Clear
- .[h2].Resize(1, c) = zrr
- .[b2].Resize(1, 6 + c).Interior.Color = 49407
- .[c2:d2].Merge
- For j = 8 To c + 7 Step 2
- .Cells(2, j).Resize(, 2).Merge
- Next
- With .[b3].Resize(m, 6 + c)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
3
查看全部评分
-
|