Delete row if Macro

doriannjeshi

Active Member
Joined
Apr 5, 2015
Messages
273
Office Version
  1. 365
Platform
  1. Windows
Hi,
I need to delete the row if is present "-"

Book2
ABCDEF
1ABCDEF
2a-bori1-31
3111111
4111111
5111111
611111
7a-bori1111
8111111
9111-61
101111
11a-bori11111
1211111
13111111
1411111
sheet1
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If the data is consistent with what you have posted you can use the same method as in your other post

VBA Code:
Sub Doria2()
   Application.ScreenUpdating = False

    With Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)

        .AutoFilter 1, "*-*"
        
        On Error Resume Next
        .Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
        
        On Error GoTo 0
        .AutoFilter
       
    End With

    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,577
Messages
6,173,163
Members
452,503
Latest member
AM74

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