View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Remove rows where value = 0

Hi Malcolm
try the following code, which test for a zero in column A - starting in
row 1 (change this according to your needs)
Frank
----
Public Sub Deletezerorows()
Dim R As Long
Dim C As Range
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For R = Rng.Rows.Count To 1 Step -1
If Cells(R, 1).Value = 0 Then 'look in column A then
Rng.Rows(R).EntireRow.Delete
End If
Next R
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub


Malcolm wrote:
Hi

I have 690 rows of information with one of the columns called "Feb
03". I would like all rows where the value in Feb 03 is "0" removed
and the rows below to move up. There will be approx 250 rows
removed. I could do this manually but I will need to be able to do
this for future worksheets so a formula to speed up the process would
be much appreciated.

Thanks in advance

Malcolm Davidson