Find Value On Sheet & Delete Rows Below

  • I am trying to select all the data in every row below where the first "flat" entry in the worksheet is but it will only go to the bottom of the data in the column where it finds flat. Some data in other columns extends beyond this so it is not working for me.


    It would work for me to select everything from where it finds flat to the very last row 65536 but I can't figure out how to do that with what I have.


    I am then deleting all this data...


    Code
    Cells.Find(What:="flat", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Activate
        ActiveCell.EntireRow.Select
        range(Selection, Selection.End(xlDown)).Select
        range(Selection, Selection.End(xlDown)).Select
        range(Selection, Selection.End(xlDown)).Select
  • Re: Select Row Based On Text In Column And Delete All Rows Below The Selected Row


    Hi
    try replacing this

    Code
    ActiveCell.EntireRow.Select


    with


    Code
    Range(ActiveCell, "A65536").EntireRow.Delete


    HTH


    Robert

  • Re: Select Row Based On Text In Column And Delete All Rows Below The Selected Row


    Code
    With ActiveSheet.UsedRange
       If WorksheetFunction.CountIf(.Cells,"*flat*") Then
             Range(.Cells.Find(What:="flat", After:=.Cells(1,1), LookIn:=xlFormulas, LookAt _ 
                :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ 
                False, SearchFormat:=False),Cells(Rows.Count,1)).EntireRow.Delete
       End If
    End With

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!