i'm looking to use a marco that would be able to search a column in said sheet and if the cell is not empty (cell T), it copy that entire rows data/formatting and paste it into another sheet [sheet "genealogie" in my case] along with any other rows that contained a not empty cell.
https://i.stack.imgur.com/ISRcD.png
I tried this code but unfortunately it copies all the lines even when the cell in question (column T) is empty.
Sub Copyl()
Dim Cell As Range
With Sheets("Tableur")
For Each Cell In .Range("B7:B" & .Cells(.Rows.Count, "B").End(xlUp).Row)
If Not IsEmpty(Range("T7:T" & .Cells(.Rows.Count, "T").End(xlUp).Row).Value) Then
.Rows(Cell.Row).Copy Destination:=Sheets("genealogie").Rows(Cell.Row)
End If
Next Cell
End With
End Sub
Thanks by advance....
If Not IsEmpty(.Range("T" & Cell.Row)) Then
. Or just useRange.AutoFilter
and avoid looping. – BigBenDim Cell As Range
-Cell
is a keyword so you might avoid future problems to get in the habit of using a different name – JohnnieLCells
is a member of the Excel object model.Cell
is not. i.stack.imgur.com/CfDlh.png – BigBen