1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| Private Sub CommandButton16_Click()
Dim x As Long, y As Long, d As Integer, p As Integer
y = 3
Feuil4.Range("A3:e" & finf4).ClearContents
Feuil4.Range("A1") = "Item moving: " + intil
For x = 2 To finf2
If Feuil2.Cells(x, 2) = prod Then
For d = 1 To 4
If d = 4 Then
p = 1
End If
Feuil4.Cells(y, d + p) = Feuil2.Cells(x, d)
Next d
Feuil4.Cells(y, 2) = "In": y = y + 1
End If
Next x
For x = 2 To finf3
If Feuil3.Cells(x, 2) = prod Then
For d = 1 To 5
Feuil4.Cells(y, d) = Feuil3.Cells(x, d)
Next d
Feuil4.Cells(y, 2) = "Out"
y = y + 1
End If
Next x
For x = 2 To finf7
If Feuil7.Cells(x, 2) = prod Then
For d = 1 To 5
Feuil4.Cells(y, d) = Feuil7.Cells(x, d)
Next d
Feuil4.Cells(y, 2) = "Moving": y = y + 1
End If
Next x
Feuil4.Range("A2:e" & finf4).Sort Key1:=Feuil4.Range("a2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
UserForm1.Hide
Feuil4.PrintPreview
UserForm1.Show
End Sub |
Partager