code to delete "0" values

thewiseguy

Well-known Member
Joined
May 23, 2005
Messages
954
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I would like a code that will delete rows (from 14-450) only if they have a "0" value in column c.


Can anyone help?


tia

-m
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Code:
Sub DeleteRows()
For i = 450 To 14 Step -1
    If Cells(i, "C").Value = "0" Then Rows(i).EntireRow.Delete
Next i
End Sub
 
Upvote 0
Try

Code:
Sub dl()
Dim i As Integer
Application.ScreenUpdating = False
Application.Calculation = xlManual
For i = 450 To 14 Step -1
    If Cells(i, 3).Value = 0 Then Rows(i).Delete
Next i
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
End Sub
 
Upvote 0
Code:
Sub DeleteRows()
For i = 450 To 14 Step -1
    If Cells(i, "C").Value = "0" Then Rows(i).EntireRow.Delete
Next i
End Sub

great, thank you!!
 
Upvote 0
Hello,

<div style="background-color:#FFFFFF; border-width:2px; border-style: groove; border-color:#ff9966; padding:4px;"><nobr><span style="font-family:Courier New,Arial; font-size:9pt ;" ><span style="color:#000080"; >Sub</span> delete_zerorows_in_C()
    <span style="color:#000080"; >With</span> Range(<span style="color:#800000"; >"C14:C450"</span>)
        .Replace 0, True, xlWhole
        .SpecialCells(xlCellTypeConstants, 4).EntireRow.Delete
    <span style="color:#000080"; >End</span> <span style="color:#000080"; >With</span>
<span style="color:#000080"; >End</span> <span style="color:#000080"; >Sub</span>

</span></nobr></div>
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,177
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top