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
| Public Sub essai_tablo()
Dim lacel As Range
Dim tablo()
'ton critère de tri
lachaîne = "P1"
n = 0
'balayage des lignes informées hors les titres de colonnes
With Sheets("risquesUT")
For i = 3 To .Cells(Rows.Count, 13).End(xlUp).Row
Set lacel = .Range("M" & i)
With lacel
If .Value = lachaîne Then
n = n + 1
'Alimentation du tableau dans la limite de 10 valeurs
ReDim Preserve tablo(1 To 13, 1 To n)
'La copie s'effectue ici à partir de la colonne B
For k = 12 To 1 Step -1
tablo(k, n) = .Offset(0, k - 12).Value
Next k
End If
End With
Next i
End With
'Information de la feuille des résultats
With Worksheets("Planaction")
.Activate
.Range([A3], [L3].Offset(UBound(tablo, 2) - 1, 0)).Value = WorksheetFunction.Transpose(tablo)
End With
Set lacel = Nothing
Erase tablo
End Sub |
Partager