Sub export2()
Dim ncol%, nomfich$, nomfeuil$, r As Range, mois As Byte, an%, mem
'---préparation---
ncol = 4 'nombre de colonnes du tableau source
nomfich = "TOTO.xlsx" 'fichier destination, à adapter
nomfeuil = "MaFeuille" 'feuille destination, à adapter
With Feuil1 'CodeName de la feuille source
Set r = .Range("A2", .Range("A" & .Rows.Count).End(xlUp)(3)).Resize(, ncol)
If IsDate(.[A1]) Then
mois = Month(.[A1])
an = Year(.[A1])
End If
End With
'---filtre avancé---
mem = r(1).Resize(2, ncol + 1).Formula 'mémorisation
r(1) = 1: r(1).Resize(, ncol + 1).DataSeries 'il faut des en-têtes
r(2, ncol + 1) = "=AND(MONTH(A3)=" & mois & ",YEAR(A3)=" & an & ")" 'critère
On Error Resume Next 'si le fichier destination n'est pas ouvert
With Workbooks(nomfich).Sheets(nomfeuil)
.Rows("2:" & .Rows.Count).Delete 'RAZ
r.AdvancedFilter xlFilterCopy, r(1, ncol + 1).Resize(2), .[A2]
.Rows(2).Delete
Application.Goto .[A1], True
End With
r(1).Resize(2, ncol + 1) = mem 'restitution
End Sub