|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
数据合并。。。
- Sub ykcbf() '//2024.7.17
- With Sheets("批次")
- r = .Cells(Rows.Count, "s").End(3).Row
- arr = .[s1].Resize(r, 9)
- End With
- ReDim brr(1 To 100000, 1 To 3)
- For j = 3 To 8 Step 3
- For i = 3 To UBound(arr)
- s = arr(i, j) & "|" & arr(i, j + 1)
- If Trim(arr(i, j)) <> Empty Then
- m = m + 1
- brr(m, 1) = arr(i, j)
- brr(m, 2) = arr(i, j + 1)
- brr(m, 3) = arr(i, j + 2)
- End If
- Next
- Next
- With Sheets("汇总")
- .UsedRange.Offset(1).Clear
- With .[a2].Resize(m, 3)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- .[a2].Resize(m, 3).Sort .[b2], 1
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
|