|
参与一下。。。
- Sub ykcbf() '//2024.4.11
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("B表")
- c = .UsedRange.Columns.Count
- For j = 1 To c
- s = .Cells(1, j)
- If s <> Empty Then d(s) = j
- Next
- End With
- With Sheets("A表")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, c)
- End With
- ReDim brr(1 To UBound(arr), 1 To 17)
- For i = 2 To UBound(arr)
- 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
- Next
- With Sheets("B表")
- .UsedRange.Offset(1) = ""
- .[a2].Resize(m, c) = brr
- .[a2].Resize(m, c).Borders.LineStyle = 1
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|