FrenchCelt
Board Regular
- Joined
- May 22, 2018
- Messages
- 214
- Office Version
- 365
- Platform
- 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.
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.