The code below 'works' but doesn't stop.
It correctly takes the first x number of rows with "y" in column F of sheet a and pastes them one after another on sheet b. Instead of stopping after the last "y", however, it then takes the first "y" row occurrence of sheet a and fills that in every row to the very end of sheet b (row 1,048,576). So sheet b does have what I need, then about 1,048,500 more rows that I don't need....
Thanks in advance for any help.
Dim cel As Range Worksheets("sheet a").Activate For Each cel In Range("f2:f1000") If cel.Value = "y" Then cel.EntireRow.Copy Worksheets("sheet b").Activate ActiveSheet.Paste Application.CutCopyMode = False ActiveCell.Offset(1, 0).Select End If Next
Bookmarks