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
|
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
For k = 2 To nbrligne
If Un(i) = Cells(k, 1) And Cells(k, 2) = "Entry" Then
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, 2), Cells(j, 25)).PasteSpecial , Operation:=xlPasteSpecialOperationAdd
Else
If Un(i) = Cells(k, 1) And Cells(k, 2) = "Exit" Then
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), Cells(j, 49)).PasteSpecial , Operation:=xlPasteSpecialOperationAdd
End If
End If
Sheets(feuilleinit).Activate
j = 2
Next k
End Sub |
Partager