|
参与一下。。。
- Sub ykcbf() '//2024.12.24
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- For Each Sht In Sheets
- If InStr("订单号|开单模板", Sht.Name) = 0 Then Sht.Delete
- Next
- With Sheets("订单号")
- r = .Cells(Rows.Count, "g").End(3).Row
- arr = .Range("e5:o" & r)
- End With
- ReDim brr(1 To 100, 1 To 8)
- If r > 5 Then
- dd = arr(2, 3)
- kh = arr(2, 1)
- rq = Format(Date, "yyyy-m-d")
- End If
- For i = 2 To UBound(arr)
- m = m + 1
- For j = 4 To UBound(arr, 2)
- brr(m, j - 3) = arr(i, j)
- Next
- Next
- x = 10: y = 6: r = 12
- Sheets("开单模板").Copy After:=Sheets(Sheets.Count)
- Set Sht = Sheets(Sheets.Count)
- With Sht
- .[g11:o18] = ""
- .[g7] = rq: .[g8] = kh
- .[i7] = dd
- .Name = dd
- If m > 8 Then .Rows(r).Resize(m - 8).Insert
- For i = 1 To m
- For j = 1 To UBound(brr, 2)
- .Cells(x + i, j + y) = brr(i, j)
- Next
- Next
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|