Advanced sorting in a spreadsheet

  • Thread starter Thread starter Ian M
  • Start date Start date
I

Ian M

In my already-populated Excel spreadhseet I want to:

- locate all the rows which contain the word "Robert" in Column "E"
(only column "E");

- cut out the entire row

- paste the entire row just after the end of the last row with data in
it.

- then remove the empty row from which they have been cut.

However, the number of rows in the spreadsheet varies from day to day,
so the last row with data in it cannot have an absolute value.

Any ideas?

Please advise.

paddymichelle
 
Ian M,
Try,
Sub Macro10()
LR = Range("E" & Rows.Count).End(xlUp).row
Range("A1:F" & LR).AutoFilter _
Field:=5, Criteria1:="Robert"
Range("E2:E" & LR) _
.SpecialCells(xlCellTypeVisible) _
.EntireRow.Copy _
Destination:=Range("A" & LR + 1)
Range("E2:E" & LR) _
.SpecialCells(xlCellTypeVisible) _
.EntireRow.Delete
Range("A1:F" & LR).AutoFilter
End Sub

Worked for me
Cecil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top