Sub a()
Set sh1 = Sheets(1)
Set shWIP = Sheets("WIP")
Set shFIN = Sheets("Finished Jobs")
LR = sh1.Range("A" & Rows.Count).End(xlUp).Row
WIPstartrow = 2
FINstartrow = 2
With sh1
For j = 2 To LR
If .Cells(j, 11).Value = 1 Then
.Range(.Cells(j, 1), .Cells(j, 10)).Copy shWIP.Cells(WIPstartrow, 1)
WIPstartrow = WIPstartrow + 1
End If
If .Cells(j, 11).Value = 2 Then
.Range(.Cells(j, 1), .Cells(j, 10)).Copy shFIN.Cells(FINstartrow, 1)
FINstartrow = FINstartrow + 1
End If
Next
End With
myPath = "D:\DATA\test\"
arr = Array("WIP", "Finished Jobs")
For j = 0 To 1
Filename = arr(j)
Sheets(Filename).Copy
ActiveWorkbook.SaveAs Filename:=myPath & Filename & ".xlsx", CreateBackup:=False
ActiveWorkbook.Close
Next
End Sub
Bookmarks