Bonjour
Quelqu'un, svp pour rendre ce code plus concis?
L'objectif étant toujours :
de filtrer, sommer, imprimer (le tout par vba)
Sub DateFiltre()
Dim Rx2, Rx3, Rx4 As Range
Dim LRw As Long
If WorksheetFunction.CountA(Cells) > 0 Then
LRw = Cells.Find(What:="*", after:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
X = LRw + 1
End If
Set Rx2 = Range("A2", "A" & X - 1)
Set Rx3 = Range("B2", "B" & X - 1)
Set Rx4 = Range("C2", "C" & X - 1)
With ActiveSheet.Range("A2").CurrentRegion
.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("critere"), Unique:=False
End With
Cells(X, 1) = "=SUBTOTAL(9," & Rx2.Address & ")"
Cells(X, 2) = "=SUBTOTAL(9," & Rx3.Address & ")"
Cells(X, 3) = "=SUBTOTAL(9," & Rx4.Address & ")"
Set Rx2 = Nothing: Set Rx3 = Nothing: Set Rx4 = Nothing
End Sub