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
|
Sub extraction_somme()
Dim X As Integer
Dim y As Integer
Windows("TDB 2013 2014.xlsm").Activate
Workbooks("TDB 2013 2014.xlsm").Sheets.Add
ActiveSheet.Name = "temporaire3"
With Sheets("temporaire")
For X = 9 To 186 Step 15
y = y + 1
.Range("B" & X & ":C" & X).Copy Sheets("temporaire3").Range("A" & y)
.Range("B" & X + 2 & ":C" & X + 2).Copy Sheets("temporaire3").Range("C" & y)
.Range("B" & X + 3 & ":C" & X + 3).Copy Sheets("temporaire3").Range("E" & y)
.Range("J" & X - 1 & ":K" & X - 1).Copy Sheets("temporaire3").Range("G" & y)
Next X
For X = 11 To 186 Step 12
y = y + 1
.Range("J" & X + 1 & ":K" & X + 1).Copy Sheets("temporaire3").Range("I" & y)
.Range("j" & X + 2 & ":K" & X + 2).Copy Sheets("temporaire3").Range("K" & y)
Next X
End With
With Sheets("temporaire3")
For X = 1 To .Cells(Rows.Count, 1).End(xlUp).Row
.Cells(X, 13) = Application.WorksheetFunction.Sum(.Cells(X, 1), .Cells(X, 3), .Cells(X, 5), .Cells(X, 7), .Cells(X, 9), .Cells(X, 11))
.Cells(X, 14) = Application.WorksheetFunction.Sum(.Cells(X, 2), .Cells(X, 4), .Cells(X, 6), .Cells(X, 8), .Cells(X, 10), .Cells(X, 12))
Next X
End With
End Sub |
Partager