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
|
Private Sub CommandButton1_Click()
Sheets.Add
ActiveSheet.Name = "Fichier_CSV"
WNbLigTot = Range("A65535").End(xlUp).Row
WLigneCopie = WNbLigTot + 3
WLigneDebutCopie = WLigneCopie
i = 1
While (i <= WNbLigTot)
'### Si la ligne est en fond JAUNE, il faut copier la ligne à la fin du tableau.
Cells(i, 1).Activate
If Selection.Interior.ColorIndex = 6 Then
ActiveCell.EntireRow.Select ' Sélection de la ligne
Selection.Copy ' Copie
WLigneCopie = WLigneCopie + 1
Cells(WLigneCopie, 1).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Cells(WLigneCopie + 1, 1).Activate
Cells(WLigneCopie, 1).Activate
Selection.NumberFormat = "m/d/yyyy"
End If
i = i + 1
Wend
'Il faut supprimer certaines colonnes du tableau
' Cells(WLigneDebutCopie, 18).Activate
' Range("J905:J935").Select
' Selection.Delete Shift:=xlToLeft
End Sub |