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
| Code :
---------
Option Explicit
Option Base 1
Const dep As Byte = 2
Sub selectionner()
Dim plage As Range
Dim fin As Long, c_in As Long, c_out As Long
Dim T_in, T_out
ReDim T_out(3, 1)
'mémorisation du tableau à traiter
With Sheets(1)
fin = .Cells(.Cells.Rows.Count, 3).End(xlUp).Row
Set plage = .Range(.Cells(dep, 3), .Cells(fin, 5))
End With
T_in = plage
'formation du tableau de restitution
For c_in = 1 To UBound(T_in)
If Not IsEmpty(T_in(c_in, 3)) Then
c_out = c_out + 1 'si il existe un index
ReDim Preserve T_out(3, c_out)
T_out(1, c_out) = T_in(c_in, 1)
T_out(2, c_out) = T_in(c_in, 2)
T_out(3, c_out) = T_in(c_in, 3)
End If
Next
Application.ScreenUpdating = False
With Sheets(2)
.Cells(dep, 2).Resize(c_out, 3) = Application.Transpose(T_out)
.Activate
End With
End Sub
--------- |
Partager