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 ligneremplies()
Dim derlg As Long
Dim qname As Range, qdb As Range, qdf As Range, qqty As Range
Dim qnom As Range, qdate As Range, tbl(1 To 359, 1 To 954)
Dim x As Long, y As Long, i As Long, j As Long, start As Single
Application.ScreenUpdating = False
start = Timer
With Sheets("TESTCODE")
derlg = .Range("F" & .Rows.Count).End(xlUp).Row
Set qdb = .Range("F1:F" & derlg)
Set qdf = .Range("G1:G" & derlg)
Set qname = .Range("E1:E" & derlg)
Set qqty = .Range("H1:H" & derlg)
End With
With Sheets("Planning rotation")
Set qnom = .Range("F11:F359")
Set qdate = .Range("XM7:BID7")
i = 0: j = 0
For x = 637 To 961
i = i + 1
For y = 11 To 359
j = j + 1
tbl(j, i) = WorksheetFunction.SumIfs(qqty, qname, .Cells(y, 6), qdb, "<= cdate(.Cells(7, x))", qdf, ">= cdate(.Cells(7, x))")
'.Cells(y, x) = WorksheetFunction.SumIfs(qqty, qname, .Cells(y, 6), qdb, "<= cdate(.Cells(7, x))", qdf, ">= cdate(.Cells(7, x))")
Next y
j = 0
Next x
.Range("XM11:BID359") = tbl
End With
Application.ScreenUpdating = True
MsgBox "durée du traitement: " & Timer - start & " secondes"
End Sub |