View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default deleting selected rows

Enter and run this small macro:

Sub delete_some_rows()

Dim r As Range, j As Long

Set r = ActiveSheet.UsedRange
j = r.Rows.Count + r.Row
Set rdel = Cells(j, "A")
For i = 1 To j - 1
v1 = Cells(i, "B").Value
v2 = Cells(i, "C").Value
v3 = Cells(i, "D").Value
If v1 = 0 And v2 = 0 And v3 = 0 Then
Set rdel = Union(rdel, Cells(i, "A"))
End If
Next

rdel.EntireRow.Delete

End Sub

--
Gary's Student


"Worker Bee" wrote:

I've got a workbook filled with worksheets containing 4 columns of
data each. I'd like to delete all of the rows (in each worksheet)
whose column B, C, and D cells contain the value "0". I am guessing
this is something that can be accomplished with nested loops, but I am
terribly rusty at VB. Can I get a push in the right direction?

Thanks much.