|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。- Sub ykcbf() '//2024.1.19
- Dim arr, d, brr
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("数据提取表")
- For j = 1 To 8
- s = .Cells(1, j)
- d(s) = j
- Next
- End With
- ReDim brr(1 To 10000, 1 To 8)
- With Sheets("统计表")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 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
- End With
- With Sheets("数据提取表")
- .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
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|