Trying to delete rows based on cell content

  • The goal: every instance of a cell containing the word "Page" in column C will cause excel to move up 1 row, then delete the next 9 rows.


    Example:


    Cell C20 has "Page: 0006"
    Excel recognizes this, then selects row 19:27 and deletes them.
    Loops back around until its at the bottom of the dataset and stops


    I have several code snippets here and there that would do some of these functions, but im not strong in VBA and don't get how to set variables, utilize offsets, and a few other elements needed here. The dataset is very irregular....but this 9 row rule seems to be how i differentiate a new page header.

  • Re: Trying to delete rows based on cell content


    Can you attach your workbook.
    [sw]*[/sw]

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Trying to delete rows based on cell content


    forum.ozgrid.com/index.php?attachment/72111/


    I've santized by simply changing text strings. Otherwise, its same data im working from.


    Essentially, if you find each instance of "Page: 000X" (X is a variable, obviously), then go up one row, and then select and delete that plus 8 rows, it'll create a consistent, standard format. I appreciate your help.


    I wiped all macros from this upload, as anything I had is mostly meaningless at this point.

  • Re: Trying to delete rows based on cell content


    Try this

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Trying to delete rows based on cell content


    You're welcome.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

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