View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Deleting specific rows

Try this

It will look from row 2 till the last row with data in column B

Sub test()
Dim r As Long
With Worksheets("Sheet1")
For r = .Cells(Rows.Count, "B").End(xlUp).Row To 2 Step -1
If .Cells(r, "B").Value = 0 Then
.Rows(r).Delete
End If
Next
End With
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Matt" wrote in message ...

I have a spreadsheet that has approximately 200 store
numbers in Column A, starting in Row 2. In Column B,
there is either a "1" or a "0" for each store. I'd like
my macro to sort by Column B and then delete all of the
stores that have a "0". There will always be the same
number of stores, but each week their Col B value will
change. I know how to do the sort, but am not sure how to
identify and delete the "0" stores. Any help would be
appreciated. FYI, I'm using Excel 97 in Windows 2000
Professional. Thanks!