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
| Sub EffaceEtFiltre()
Dim Plage As Range
'neutralise le recalcule
Application.Calculation = xlCalculationManual
With Sheets(2)
' regroupement de tes deux plages dans une seule
Set Plage = Union(.Range(.Cells(6, 2), .Cells(.Cells(.Rows.Count, 2).End(xlUp).Row, 9)), .Range(.Cells(7, 10), .Cells(.Cells(.Rows.Count, 2).End(xlUp).Row, 39)))
'effacement des deux plage
Plage.ClearContents
End With
'remise en place du recalcule automatique
Application.Calculation = xlCalculationAutomatic
' partie liée au filtre avancé
With Sheets(1)
Set Plage = .Range(.Cells(4, 1), .Cells(.Cells(.Rows.Count, 4).End(xlUp).Row, 9))
Plage.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Sheets(2).[B1:B2], CopyToRange:=Sheets(2).[B6], Unique:=False
End With
With Sheets(2)
With .Range("B6:J6")
.Font.Bold = True
.Font.Size = 16
.Font.ColorIndex = 2
.Interior.ColorIndex = 41
.HorizontalAlignment = xlCenter
End With
.Range("F7:J65536").HorizontalAlignment = xlCenter
.Range("B7:E65536").HorizontalAlignment = xlLeft
Set Plage = .Range(.Cells(7, 11), .Cells(.Cells(.Rows.Count, 2).End(xlUp).Row, 11))
Plage.FormulaR1C1 = .Cells(2, 11).FormulaR1C1
End With
End Sub |
Partager