Delete row if Macro

doriannjeshi

Active Member
Joined
Apr 5, 2015
Messages
301
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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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,942
Messages
6,175,544
Members
452,652
Latest member
eduedu

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