Delete Rows that Meet Certain Criteria in VBA

Associated Files Download Links

The following Subroutine will delete each row in a range where the value in Column A begins with a prescribed piece of text:

For example Delete_Rows(Sheets(“Sheet1”).Range(“A1:E23”,”Dog”) will delete all the rows in the range A1:E23 where the value in Column A begins with the word “Dog”. Note the use of Ucase means that the formulae is case INSENSITIVE i.e cells that begin with any of DOG, Dog, DoG or dog will all be deleted.

delete rows
Will become:
delete rows meeting certain criteria

alt text

You may also like some of this related content...

Find Max Value For Each Column in Range The following function will return the Maximum
Select Non-Contiguous Columns To select non contiguous columns using VBA, you need to hard code
The standard Excel “Column” Function returns the number rather than the letter of the column
If you need to get the active cell's column or row from VBA, use this
UsedRange - Find Last Used Cell, Column or Row The following code will return in
Automate Excel
Left Menu Icon