View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tom Ogilvy
 
Posts: n/a
Default create macro - if cell is 0 delete row

Sub DeleteRowswithZeroInColumnA()
Dim lastrow as Long, i as Long
lastrow = cells(rows.count,1).End(xlup).Row
for i = lastrow to 2 step -1
if cells(i,1).Value = 0 then
rows(i).Delete
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"pywhacket" wrote:

Is there a way to create a macro that will search a section of a worksheet
and delete rows that have a zero in the leading cell?

Thanks in advance!