|
参与一下。。。
- Sub ykcbf() '//2024.9.17
- Application.ScreenUpdating = False
- With Sheets("分支电缆")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[b1].Resize(r, 4)
- End With
- Set Rng = Sheets("模板").Rows("1:5")
- ReDim brr(1 To r, 1 To 4)
- For i = 3 To UBound(arr)
- If arr(i, 1) <> Empty Then
- n = n + 1
- For j = 1 To UBound(arr, 2)
- brr(n, j) = arr(i, j)
- Next
- End If
- Next
- m = 1
- On Error Resume Next
- With Sheets("电缆标牌")
- .Cells.Clear
- For i = 1 To n Step 4
- Rng.Copy .Cells(m, 1)
- For x = 1 To 4
- For j = 1 To UBound(brr, 2)
- .Cells(m + j, 2 + (x - 1) * 3) = brr(i, j)
- Next
- Next
- m = m + 5
- Next
- End With
- Set Rng = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|