macro to delete lines

  • Thread starter Thread starter Kevin Depree
  • Start date Start date
K

Kevin Depree

Hi,

I want to write a macro that looks in one column of a
page, and if the column has a '0' in it, it deletes the
row.

This would continue until all rows with '0' are deleted.

Anyone help
 
Hi,

Please see the suggestion to your same post in the
Programming group.

John Mansfield
 
Option Explicit

Sub deleteRows()

Dim i As Integer
Dim n As Integer
Dim area

With Sheet1

n = .Range("a1").CurrentRegion.Rows.Count

For i = 2 To n

If (.Range("a" & i).Value = 0) Then

Range("A" & i).EntireRow.Delete

Else

GoTo None

End If

Next i

End With

None:
MsgBox "No rows to delete!"

End Su
 

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