|
参与一下。。。
- Sub ykcbf() '//2024.8.19
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set sh = ThisWorkbook.Sheets("汇总")
- With sh
- c = .Cells(1, "XFD").End(1).Column
- zrr = .[a1].Resize(, c)
- For j = 1 To UBound(zrr, 2) - 1
- s = zrr(1, j)
- d(s) = j
- Next
- End With
- ReDim brr(1 To 10000, 1 To c)
- For Each sht In Sheets
- If sht.Name <> sh.Name Then
- With sht
- Set Rng = .UsedRange.Find("施工人")
- bt = Rng.Row: col = Rng.Column
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .Cells(bt, "XFD").End(1).Column
- arr = .[a1].Resize(r, c)
- fn = .Name
- End With
- For i = bt + 1 To UBound(arr)
- If Val(arr(i, 7)) Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- s = arr(bt, j)
- If d.exists(s) Then
- brr(m, d(s)) = arr(i, j)
- End If
- Next
- brr(m, UBound(zrr, 2)) = fn
- End If
- Next
- End If
- Next
- With sh
- .[a2:k10000].ClearContents
- With .[a2].Resize(m, 11)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|