I want the macro to delete rows with any 3 letters specified of a1 which is DLNRST
This means it will delete row A18 which has word ANGELED since it has DLN
Find file attached
I want the macro to delete rows with any 3 letters specified of a1 which is DLNRST
This means it will delete row A18 which has word ANGELED since it has DLN
Find file attached
To help code faster:
This code will delete each cell in range first, then come back and delete rows with blank cells.
PHP Code:
Option Explicit
Sub test()
Dim i&, count&, Lr&, cell As Range
Lr = Cells(Rows.count, "A").End(xlUp).Row
For Each cell In Range("A3:A" & Lr)
count = 0
For i = 1 To Len(cell)
If InStr(1, Range("A1").Value, Mid(cell.Value, i, 1)) > 0 Then
count = count + 1
If count = 3 Then
cell.ClearContents
Exit For
End If
End If
Next i
Next cell
Range("A3:A" & Lr).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub
Quang PT
Exactly 3 ( or more) ?
If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.
Here is another macro that you can consider...
Please Login or Register to view this content.
Last edited by Rick Rothstein; 03-10-2022 at 03:10 AM.
Thank you Rick works exactly the way , once upon a time I have used your macro too for other situation like this on stocking
Bebo Thank you too , I have collected both yours and Ricks
Minium 3 John
Last edited by makinmomb; 03-10-2022 at 05:01 AM. Reason: minumum
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks