Macro help

  • Thread starter Thread starter phil2006
  • Start date Start date
P

phil2006

Can anyone help me write a macro that deletes the entire row if the cell
in the corresponding row in column AL = "0" ?

Thanks

Phil
 
try

for i =cells(rows.count,"al").end(xlup).row to 2 step -1
if cells(i,"al")=0 then rows(i).delete
next i
 
Sub DeleteRows_With_Zero()
findstring = "0"
Set B = Columns(38).Find(What:=findstring, LookAt:=xlPart)
While Not (B Is Nothing)
B.EntireRow.Delete
Set B = Columns(38).Find(What:=findstring, LookAt:=xlPart)
Wend
End Sub


Gord Dibben MS Excel MVP
 
Thanks! This isn't working entirely tho. I want the row deleted if the
cell has the value "0". Alternatively if I could Fill the whole row
with a colour it would be equally as effective and possibly more
useful.

Thanks



Phil
 
I think xlPart should be replaced with xlWhole.

707 should be kept
0 should be deleted.
 
Thanks Dave.

This is the second time I have posted this code without making the correction.

Will make the change and re-archive.


Gord

I think xlPart should be replaced with xlWhole.

707 should be kept
0 should be deleted.

Gord Dibben MS Excel MVP
 
Back
Top