Deleting rows with 0 value in Column X

  • Thread starter Thread starter CapitolMike
  • Start date Start date
C

CapitolMike

Hi,

I would like to create a macro to delete all rows in my worksheet tha
have a 0 value in column X. Any easy instructions, or info on a boo
that would point me in the right direction?

Thanks,

Mik
 
A little digging in the google archives and code
manipulation and I came up with:

Sub DeleteRows()
Dim iLastRow As Integer
Dim i As Integer

Application.ScreenUpdating = False

iLastRow = Cells(Rows.Count, "X").End(xlUp).Row
For i = iLastRow To 1 Step -1
With Cells(i, 24)
If .Value = 0 Then
.EntireRow.Delete
End If
End With
Next i

Application.ScreenUpdating = True

End Sub

--

Press ALT+F11, Insert > Module, and paste in the above
macro. Then flip back to XL and run the macro.

HTH
Jason
Atlanta, GA
 
Thank you so much. You just saved me literally tens of hours of work!!!
 

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