Thread: Macro required
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Macro required

Hi Ian,

Am Tue, 1 May 2012 13:01:04 -0700 (PDT) schrieb pcorcele:

Can someone tell me how to build a macro to do the following.
Starting at c1 check to see if there is a zero: if it IS a zero
delete the entire line
Now drop down one line to C2 and do the same and if it NOT a zero,
jump to the next line
carry on doing that until the end of any data


try:

Sub DeleteRows()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 3).End(xlUp).Row
For i = LRow To 1 Step -1
If Cells(i, 3) = 0 Then
Rows(i).Delete
End If
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2