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
|
Sub Totaux(i As Integer, Un As Collection, nbrligne As Integer, feuilleinit As String, feuillefin As String)
Dim j As Integer
j = 2
Sheets(feuilleinit).Activate 'Là où il y a mes données
For k = 2 To nbrligne
If Un(i) = Cells(k, 1) And Cells(k, 2) = "Entry" Then 'Test pour savoir s'ils sont en "Entry"
Range(Cells(k, 5), Cells(k, 29)).Copy
Sheets(feuillefin).Activate 'Là où je fais le totaux
While Cells(j, 1) <> Un(i) And j < Un.Count + 1
j = j + 1
Wend
Range(Cells(j, 2)).PasteSpecial , Operation:=xlPasteSpecialOperationAdd 'On colle la ligne en faisant une somme
Else
If Un(i) = Cells(k, 1) And Cells(k, 2) = "Exit" Then 'Ou en "Exit"
Range(Cells(k, 5), Cells(k, 28)).Copy
Sheets(feuillefin).Activate
While Cells(j, 1) <> Un(i) And j < Un.Count + 1
j = j + 1
Wend
Range(Cells(j, 26)).PasteSpecial , Operation:=xlPasteSpecialOperationAdd 'On colle la ligne en faisant une somme
End If
End If
Sheets(feuilleinit).Activate
Next k
End Sub |
Partager