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 45 46 47 48 49
|
Option Explicit
Sub New_customers()
' Une adaptation du code FiltreColonnes de Jacques BOISGONTIER
Dim MatriceSource As Variant
Dim MatriceFiltree As Variant
Dim ShCible As Worksheet
Dim I As Long
MatriceSource = Sheets("JD NET 0718").UsedRange
MatriceFiltree = FiltreArrayCol_JB(MatriceSource, Array(3, 95)) ' on prend les colonnes 3, 95
Set ShCible = Sheets.Add
With ShCible
.Range("B1").Resize(UBound(MatriceFiltree), UBound(MatriceFiltree, 2)) = MatriceFiltree
For I = .UsedRange.SpecialCells(xlCellTypeLastCell).Row To 1 Step -1
If .Cells(I, 3) <> "New_customer" Then .Cells(I, 3).EntireRow.Delete
Next I
' .Columns(3).Clear ' Pour supprimer la colonne New_customer
End With
Set ShCible = Nothing
End Sub
Function FiltreArrayCol_JB(Tableau As Variant, ColResult As Variant)
' De Jacques BOISGONTIER
Dim Decal As Long, I As Long, C As Long
Dim MatriceResultante()
ReDim MatriceResultante(LBound(Tableau) To UBound(Tableau), 1 To UBound(ColResult) - LBound(ColResult) + 1)
Decal = 1 - LBound(ColResult)
For I = LBound(Tableau, 1) To UBound(Tableau, 1)
For C = LBound(ColResult) To UBound(ColResult)
MatriceResultante(I, C + Decal) = Tableau(I, ColResult(C))
Next C
Next I
FiltreArrayCol_JB = MatriceResultante
End Function |
Partager