|
本帖最后由 linxing_1 于 2020-3-20 11:27 编辑
把第5行的70改成 sht2.Cells(Rows.Count, 1).End(xlUp).Row 就可以了
Sub printOrder()
Dim i As Integer
Dim sht1, sht2 As Worksheet
Set sht2 = Sheets("sheet2")
For i = 21 To sht2.Cells(Rows.Count, 1).End(xlUp).Row '把70改成这个就可以了
Cells(4, 3) = Mid(sht2.Cells(1, 5), 5, 7)
Cells(4, 5) = sht2.Cells(i, 1)
Cells(6, 1) = sht2.Cells(i, 2)
Cells(6, 2) = sht2.Cells(i, 6)
Range("A1:J18").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
Collate:=True, IgnorePrintAreas:=False
Next
End Sub |
|