Famille de feuilles de calcul Microsoft avec des outils pour l’analyse, le graphique et la communication des données.
Avec les mises en forme, la première macro devient donc :
Sub test()
Dim C As Range, Plage As Range
With Sheets("Concours")
Set Plage = .Range("B14", .Cells(.Rows.Count, 2).End(xlUp)).Resize(, 2)
End With
Application.EnableEvents = False
With Sheets("Repechage")
.Unprotect
Plage.Copy
.[B6].PasteSpecial xlPasteValues
.[B6].Resize(Plage.Rows.Count, 2).Sort .[B6], xlAscending, Header:=xlNo
.[B6].Resize(Plage.Rows.Count, 16).Borders.LineStyle = xlContinuous
.[B6].Resize(Plage.Rows.Count, 16).Interior.ColorIndex = xlNone
.[B6].Resize(Plage.Rows.Count, 16).FormatConditions.Delete
.Protect
End With
Application.EnableEvents = True
End Sub
La suppression :
Sub test1()
Application.EnableEvents = False
With Sheets("Repechage")
.Unprotect
.Range(.[B6], .Cells(.Rows.Count, 2).End(xlUp)).Resize(, 16).Clear
With .ListObjects("Tableau2")
For i = .ListRows.Count To 1 Step -1
.ListRows(i).Delete
Next i
End With
.Protect
End With
Application.EnableEvents = True
End Sub
On peut inclure la suppression dans la procédure de copie.
Daniel