|
参与一下。。。- Sub ykcbf() '//2024.1.19
- Dim arr, brr, d
- Set d = CreateObject("Scripting.Dictionary")
- Set sh = ThisWorkbook.Sheets("汇总")
- For x = 1 To 8
- s = sh.Cells(1, x)
- d(s) = x
- Next
- ReDim brr(1 To 10000, 1 To 8)
- For Each sht In Sheets
- If sht.Name <> sh.Name Then
- arr = sht.UsedRange
- For i = 2 To UBound(arr)
- If arr(i, 1) <> Empty Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- s = arr(1, j)
- If d.exists(s) Then
- brr(m, d(s)) = arr(i, j)
- End If
- Next
- End If
- Next
- End If
- Next
- With sh
- .UsedRange.Offset(1).Clear
- With .[a2].Resize(m, 8)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
|