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
|
Sub tab()
Dim i, j, x, last, statut As Integer
Dim tabSche() As Variant
Dim tabScheDate() As Date
Application.ScreenUpdating = False
With Sheets("Data")
.Select
'test si il y a des valeur
If .Range("Q3").Value = "" Then
Application.ScreenUpdating = True
Exit Sub
End If
last = .Range("Q65536").End(xlUp).Row
x = 0
For i = 3 To last
If i = 3 Or Cells(i, 17) <> Cells(i - 1, 17) Then
x = x + 1
ReDim Preserve tabSche(1 To 11, 1 To x)
For j = 1 To 9
tabSche(j, x) = Cells(i, 16 + j)
Next j
ReDim Preserve tabScheDate(1 To 2, 1 To x)
For j = 1 To 2
tabScheDate(j, x) = Format(Cells(i, 25 + j), "dd/mm/yy")
Next j
End If
Next i
End With
With Sheets("TCD")
.Select
Range(Cells(5, 29), Cells(UBound(tabSche, 2) + 4, 37)) = Application.WorksheetFunction.Transpose(tabSche)
Range(Cells(5, 38), Cells(UBound(tabScheDate, 2) + 4, 39)) = Application.WorksheetFunction.Transpose(tabScheDate)
end sub |
Partager