Delete ntire row if cell = Yes

Shellys28

New Member
Joined
Jun 15, 2015
Messages
12
I want to delete any row in the "Delivered" sheet that has "Yes" in a cell in Column "G:G"

For Each cell In Sheets("Delivered").Range("G:G")
If cell.Value = "Yes" Then
deleteRow = cell.Row
End If
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try this:
Code:
Sub Filter_Me()
'Modified 12-18-17 9:50 PM EST
Application.ScreenUpdating = False
    With Sheets("Delivered").Range("G1:G" & Sheets("Delivered").Cells(Rows.Count, "G").End(xlUp).Row)
        .AutoFilter 1, "Yes"
        .Offset(1).EntireRow.Delete
        .AutoFilter
    End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try this:

Code:
Sub Shellys28()
' hiker95, 12/19/2017, ME1035831
Dim Addr As String
Addr = "G1:G" & Cells(Rows.Count, "G").End(xlUp).Row
Range(Addr) = Evaluate(Replace("IF(@="""","""",IF(@=""Yes"",""#N/A"",@))", "@", Addr))
On Error GoTo NoDeletes
Columns("G").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
NoDeletes:
End Sub
 
Upvote 0
The above macro, in my reply #3 will run in the Active Worksheet.


Try this:

Code:
Sub Shellys28_V2()
' hiker95, 12/19/2017, ME1035831
Dim Addr As String
With Sheets("Delivered")
  Addr = "G1:G" & .Cells(.Rows.Count, "G").End(xlUp).Row
  Range(Addr) = Evaluate(Replace("IF(@="""","""",IF(@=""Yes"",""#N/A"",@))", "@", Addr))
  On Error GoTo NoDeletes
  .Columns("G").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
NoDeletes:
End With
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,225,315
Messages
6,184,234
Members
453,223
Latest member
Ignition04

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