|
参与一下。。。- Sub ykcbf() '//2024.1.18
- Dim arr, brr, d
- Set d = CreateObject("Scripting.Dictionary")
- Set sh = ThisWorkbook.Sheets("汇总")
- For Each sht In Sheets
- If sht.Name <> sh.Name Then
- With sht
- fn = .Name
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .Range("a6:v" & r)
- If Not d.exists(fn) Then Set d(fn) = CreateObject("Scripting.Dictionary")
- d(fn)("标题0") = .[a4]
- d(fn)(arr(1, 1)) = arr(1, 2)
- d(fn)(arr(2, 1)) = arr(2, 2)
- d(fn)(arr(3, 1)) = arr(3, 2)
- d(fn)(arr(1, 12)) = arr(1, 13)
- d(fn)(arr(2, 12)) = arr(2, 13)
- d(fn)(arr(3, 12)) = arr(3, 13)
- d(fn)(arr(1, 21)) = arr(1, 22)
- d(fn)(arr(2, 21)) = arr(2, 22)
- d(fn)(arr(3, 21)) = arr(3, 22)
- End With
- End If
- Next
- With sh
- .[a6:j1000] = ""
- .[j6].Resize(d.Count, 1) = Application.Transpose(d.keys)
- arr = .[a5].Resize(d.Count + 1, 10)
- For i = 2 To UBound(arr)
- For j = 1 To UBound(arr, 2) - 1
- s = arr(i, 10)
- If d.exists(s) Then
- arr(i, j) = d(s)(arr(1, j))
- End If
- Next
- Next
- .[a5].Resize(d.Count + 1, 10) = arr
- .[a5].Resize(d.Count + 1, 10).Borders.LineStyle = 1
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
|