Macro that deletes rows with "0" value cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have several worksheets with data. I'd like to specify a column and
wherever there is a 0 value in that column, the macro will delete the whole
row it is in. The column to look for the 0 in is different in each of my
worksheets so somehow i have to specify which one it is to the macro
beforhand.

any help aprecciated,

Steven.
 
Try this

Sub m()
colabel = InputBox("column label ?")
lrow = Cells(Rows.Count, colabel).End(xlUp).Row
For i = lrow To 1 Step -1
If Cells(i, colabel) = 0 Then Rows(i).Delete
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top