How to Delte Multiple Rows Given a Value Existing

  • Thread starter Thread starter Jako
  • Start date Start date
J

Jako

Many thanks Dave that worked great !!!

Except that it only deletes the entries on one worksheet.

How would i use this code on EVERY worksheet in the active workbook?

Thanks agai
 
oops. I didn't notice that last part:

Option Explicit
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Dim wks As Worksheet

Application.ScreenUpdating = False

For Each wks In ActiveWorkbook.Worksheets
With wks
lastrow = .Cells(.Rows.Count, "F").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
Select Case LCase(Cells(row_index, "F").Value)
Case Is = "yellow", "green", "red", "blue"
.Rows(row_index).Delete
End Select
Next row_index
End With
Next wks

Application.ScreenUpdating = True
End Sub

But are you still sure you want to start at lastrow-1?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top