Selection first filtered line

Solved
mickysor -  
 mickysor -
```vba
Sub CopierPremiereLigneFiltrée()
Dim wsSource As Worksheet
Dim wsDestination As Worksheet
Dim ligneVisible As Range
Dim plageFiltrée As Range

Set wsSource = ThisWorkbook.Sheets("FeuilleSource") ' Remplacer par le nom de votre feuille source
Set wsDestination = ThisWorkbook.Sheets("FeuilleDestination") ' Remplacer par le nom de votre feuille destination

' Vérifier si la feuille source a un filtre
If wsSource.AutoFilterMode Then
' Définir la plage filtrée
Set plageFiltrée = wsSource.AutoFilter.Range

' Trouver la première ligne visible après le filtre
On Error Resume Next ' Ignorer les erreurs si aucune ligne visible
Set ligneVisible = plageFiltrée.Offset(1).SpecialCells(xlCellTypeVisible).Rows(1)
On Error GoTo 0 ' Réactiver les erreurs

If Not ligneVisible Is Nothing Then
' Copier la première ligne visible vers la feuille de destination
ligneVisible.Copy Destination:=wsDestination.Range("A1") ' Modifier la cellule de destination si besoin
Else
MsgBox "Aucune ligne visible après le filtre."
End If
Else
MsgBox "Le filtre n'est pas activé sur la feuille source."
End If
End Sub
```

1 answer

mickysor
 
Great! I found it!! Case solved.
Here’s what to put so that the first line is selected after filtering:

Range("A1:i" & Range("A65536").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Select

And no more copy-paste issues!!!

Have a great day everyone.
Unfortunately, I don’t know how to mark this post as resolved; if someone could help me, I’d be grateful.
2