I need some vba code that will search down a column A for a keyword, and when found, if the 2 cells above that word both have data, then delete the row directly above it. If there is only 1 cell directly above with data (and the one above that one is empty), then do nothing.
Example:
A 1
A 2
A 3 data
A 4 data (<- since cells A3 & A4 contain data, therefore DELETE THIS ROW)
A 5 KEYWORD
A 6
A 7
A 8 (< since this cell is empty, therefore DO NOTHING)
A 9 data
A 10 KEYWORD
A 11
In other words:
the 1st instance of search keyword found is at A5
Since the two cells above the keyword (A3 & A4) both have data, therefore delete the row above the keyword.
The 2nd instance of search keyword is at A10
Since only the one cell (A9) above the keyword contains data, therefore do nothing, and go to the next search, etc…
I appreciate your help.
Example:
A 1
A 2
A 3 data
A 4 data (<- since cells A3 & A4 contain data, therefore DELETE THIS ROW)
A 5 KEYWORD
A 6
A 7
A 8 (< since this cell is empty, therefore DO NOTHING)
A 9 data
A 10 KEYWORD
A 11
In other words:
the 1st instance of search keyword found is at A5
Since the two cells above the keyword (A3 & A4) both have data, therefore delete the row above the keyword.
The 2nd instance of search keyword is at A10
Since only the one cell (A9) above the keyword contains data, therefore do nothing, and go to the next search, etc…
I appreciate your help.