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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| Sub stock()
Dim C As Range, Plage As Range, Dico As Object, Ligne As Long, Lig As Long
Set Dico = CreateObject("Scripting.Dictionary")
With Sheets("stock S")
Set Plage = .Range("A1", .Cells(.Rows.Count, 1).End(xlUp))
End With
With Sheets("stocks S1")
For Each C In Plage
If Not Dico.exists(C.Value) Then
Dico.Add C.Value, C.Value
Ligne = Ligne + 1
If IsNumeric(C.Value) Then
.Cells(Ligne, 1).NumberFormat = "@"
End If
.Cells(Ligne, 1) = C.Value
.Cells(Ligne, 2) = C.Offset(, 1).Value
Else
Lig = Application.Match(C.Value, .[A:A], 0)
.Cells(Lig, 2).Value = .Cells(Lig, 2).Value + C.Offset(, 1).Value
End If
Next C
End With
End Sub
Sub Entrées()
Dim C As Range, Plage As Range, Dico As Object, Ligne As Long, Lig As Long
Set Dico = CreateObject("Scripting.Dictionary")
With Sheets("Entrées S")
Set Plage = .Range("A1", .Cells(.Rows.Count, 1).End(xlUp))
End With
With Sheets("Entrées S1")
For Each C In Plage
If Not Dico.exists(C.Value) Then
Dico.Add C.Value, C.Value
Ligne = Ligne + 1
If IsNumeric(C.Value) Then
.Cells(Ligne, 1).NumberFormat = "@"
End If
.Cells(Ligne, 1) = C.Value
.Cells(Ligne, 2) = C.Offset(, 1).Value
Else
Lig = Application.Match(C.Value, .[A:A], 0)
.Cells(Lig, 2).Value = .Cells(Lig, 2).Value + C.Offset(, 1).Value
End If
Next C
End With
End Sub
Sub Sorties()
Dim C As Range, Plage As Range, Dico As Object, Ligne As Long, Lig As Long
Set Dico = CreateObject("Scripting.Dictionary")
With Sheets("Sorties S")
Set Plage = .Range("A1", .Cells(.Rows.Count, 1).End(xlUp))
End With
With Sheets("Sorties S1")
For Each C In Plage
If Not Dico.exists(C.Value) Then
Dico.Add C.Value, C.Value
Ligne = Ligne + 1
If IsNumeric(C.Value) Then
.Cells(Ligne, 1).NumberFormat = "@"
End If
.Cells(Ligne, 1) = C.Value
.Cells(Ligne, 2) = C.Offset(, 1).Value
Else
Lig = Application.Match(C.Value, .[A:A], 0)
.Cells(Lig, 2).Value = .Cells(Lig, 2).Value + C.Offset(, 1).Value
End If
Next C
End With
End Sub |
Partager