仅供参考
- Sub 打印()
- Dim EN As Long, i As Integer
- Dim S1 As Worksheet, S2 As Worksheet
- Set S1 = Sheets("送货单")
- Set S2 = Sheets("送货记录")
- 'If S1.Cells(14, 1) = "" Then MsgBox "斕奾帤怀フ楷億囀セ!": Exit Sub
- ActiveSheet.PrintOut Copies:=1
- With S1
- EN = S2.Cells(65500, 7).End(3).Row + 1
- S2.Cells(EN, 1).Resize(, 3) = Array(Mid(.[F2], 3), .[B6], .[G6]) '送货单号,客户名称,送货日期
- For i = 12 To .[A20].End(xlUp).Row
- S2.Cells(EN, 4).Resize(, 8) = Array(.Cells(i, 1), .Cells(i, 2), .Cells(i, 3), .Cells(i, 4), .Cells(i, 5), .Cells(i, 6), .Cells(i, 7), .Cells(i, 8))
- Next i
- .Cells(2, 6) = "№:HZ" & Year(Now()) & Format(Month(Now()), "00") & Format(Right(Cells(2, 6), 3) + 1, "000")
- .Range("A14:I23").ClearContents
- End With
- End Sub
复制代码 |