Dang Le Khanh Ninh
Thành viên mới 

			
		- Tham gia
 - 5/6/21
 
- Bài viết
 - 13
 
- Được thích
 - -2
 
For j = 1 To Column_Draft
If j = 1 Then
If 0 < Sheets("Draft").Cells(2, j).Value < Lotsize Then Sheets("Draft").Cells(3, j).Value = 0
If Sheets("Draft").Cells(2, j).Value >= Lotsize Then Sheets("Draft").Cells(3, j).Value = Application.RoundDown(Sheets("Draft").Cells(2, j).Value / Lotsize, 0) * Lotsize
End If
If j > 1 And j < End_column And Sheets("Draft").Cells(2, j).Value > 0 Then
Total_old1 = Application.Sum(Sheets("Draft").Range("3:3"))
Total_new1 = Application.Sum(Sheets("Draft").Range(Cells(2, 1), Cells(2, j)))
Sheets("Draft").Cells(3, j).Value = Int((Total_new1 - Total_old1) / Lotsize) * Lotsize
End If
If j > 1 And j = End_column And Sheets("Draft").Cells(2, j).Value > 0 Then
Total_old2 = Application.Sum(Sheets("Draft").Range("3:3"))
Sheets("Draft").Cells(3, j).Value = QtyDay + QtyEndDate + QtyStartDate - Total_old2
End If
Next j
For j = 1 To Column_Draft
Sheets("Pro Finishing").Cells(Row_Paste, Column_Std + j - 1).Value = Sheets("Draft").Cells(3, j).Value
Next j
End If
				
			If j = 1 Then
If 0 < Sheets("Draft").Cells(2, j).Value < Lotsize Then Sheets("Draft").Cells(3, j).Value = 0
If Sheets("Draft").Cells(2, j).Value >= Lotsize Then Sheets("Draft").Cells(3, j).Value = Application.RoundDown(Sheets("Draft").Cells(2, j).Value / Lotsize, 0) * Lotsize
End If
If j > 1 And j < End_column And Sheets("Draft").Cells(2, j).Value > 0 Then
Total_old1 = Application.Sum(Sheets("Draft").Range("3:3"))
Total_new1 = Application.Sum(Sheets("Draft").Range(Cells(2, 1), Cells(2, j)))
Sheets("Draft").Cells(3, j).Value = Int((Total_new1 - Total_old1) / Lotsize) * Lotsize
End If
If j > 1 And j = End_column And Sheets("Draft").Cells(2, j).Value > 0 Then
Total_old2 = Application.Sum(Sheets("Draft").Range("3:3"))
Sheets("Draft").Cells(3, j).Value = QtyDay + QtyEndDate + QtyStartDate - Total_old2
End If
Next j
For j = 1 To Column_Draft
Sheets("Pro Finishing").Cells(Row_Paste, Column_Std + j - 1).Value = Sheets("Draft").Cells(3, j).Value
Next j
End If
	
	  

