Sub Fill()
Dim i As Integer
Dim j As Long
Dim k As Long
j = ThisWorkbook.Sheets("Раскрой").Cells(2, 31)
k = ThisWorkbook.Sheets("Раскрой").Cells(2, 32)
With Workbooks.Add.Sheets(1) '.Add
.Cells(1, 1) = "Кол-во в партии"
.Cells(1, 2) = "Суммарная трудоемкость остатков"
.Cells(1, 3) = "Партия, час"
For i = j To k
.Cells(i - j + 2, 1) = i
ThisWorkbook.Sheets("Раскрой").Cells(2, 4) = i
.Cells(i - j + 2, 2) = ThisWorkbook.Sheets("Раскрой").Cells(23, 31)
.Cells(i - j + 2, 3) = ThisWorkbook.Sheets("Раскрой").Cells(23, 28)
Next i
.Range(Cells(1, 1), Cells(i - j + 2, 3)).Sort Key1:=Range("B2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
.Select
End With
End Sub
|