Finding Text in One Column and Deleting Row if Certain Text Found in Next Column

FrenchCelt

Board Regular
Joined
May 22, 2018
Messages
206
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to code a macro to search for specific text in one column, then looking in the same row in the next column for specific text, and if found, deleting that entire row. For example, in Column G I want to search for FILL CP VHCL. Say this is found in G7 and G8. If the text in H7 says CASES, I want to delete row 7. The macro will have to run through this several times, as FILL CP VHCL will appear dozens of times in the spreadsheet. I have the sense I need to do something like:

Range("G5").Select
Dim fnd As Range
Set fnd = Range("G:G").Find("FILL CP VHCL", , , xlWhole, , , False, , False)

to identify all cells in Column G with that text, and I know I need to do some kind of "if" statement to offset a cell over, and I know how to delete a row once the row is identified, but I don't know how to string together the next conditional involving the text required to identify the row to be deleted ("CASES").

Any help would be appreciated.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Why not simply autofilter on cols G & H & then delete the visible rows?
 
Upvote 0
You know, I've done that before with other macros and it never even occurred to me when I set out to make this one. :LOL: Sometimes the simplest answer is best. Thank you.
 
Upvote 0
You're welcome & thanks for the feedback.
If you have any problems, just post back.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top