Macro to Delete rows on a criteria

R

rjacmuto32

I have macro code to hide rows based on a certain critera but I don't
know how to adapt the code to delete the rows. Basically it checks a
column and for every row <0 it hides it. Problem is I want to delete
the row. How do i change the code below to delete?


BeginRow = 2
EndRow = 500
ChkCol = 13

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value < 1 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
 
G

Guest

Try changing this line
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
to this:
Cells(RowCnt, ChkCol).EntireRow.Delete
 

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

Top