View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default How to Delte Multiple Rows Given a Value Existing

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?

Jako wrote:

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 again

--
Jako
------------------------------------------------------------------------
Jako's Profile: http://www.excelforum.com/member.php...fo&userid=8710
View this thread: http://www.excelforum.com/showthread...hreadid=271697


--

Dave Peterson