Sub CopierDernièresLignesVisibles()
Dim nombre&, derlig&, i&, n&, P As Range
nombre = 30 'les dernières lignes à afficher
With Feuil1 'CodeName de la feuille source
'derlig = .Cells.Find("*", , xlValues, , xlByRows, xlPrevious).Row
derlig = Application.Match(9 ^ 9, .[A:A])
For i = derlig To 2 Step -1
If Not .Rows(i).Hidden Then
n = n + 1
Set P = Union(IIf(P Is Nothing, .Rows(i), P), .Rows(i))
If n = nombre Then Exit For
End If
Next
End With
With Feuil2 'CodeName de la feuille de restitution
If Not P Is Nothing Then P.Copy .[A2]
.Rows(n + 2 & ":" & .Rows.Count).Delete 'RAZ
.Activate
End With
End Sub