+ Reply to Thread
Results 1 to 7 of 7

delete rows with words of certain letters

  1. #1
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2019 PRO
    Posts
    3,616

    delete rows with words of certain letters

    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
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: delete rows with words of certain letters

    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 1 To Len(cell)
                If 
    InStr(1Range("A1").ValueMid(cell.Valuei1)) > 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

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: delete rows with words of certain letters

    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.

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,409

    Re: delete rows with words of certain letters

    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.

  5. #5
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2019 PRO
    Posts
    3,616

    Re: delete rows with words of certain letters

    Thank you Rick works exactly the way , once upon a time I have used your macro too for other situation like this on stocking

  6. #6
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2019 PRO
    Posts
    3,616

    Re: delete rows with words of certain letters

    Bebo Thank you too , I have collected both yours and Ricks

  7. #7
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2019 PRO
    Posts
    3,616

    Re: delete rows with words of certain letters

    Minium 3 John
    Last edited by makinmomb; 03-10-2022 at 05:01 AM. Reason: minumum

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 16
    Last Post: 01-10-2020, 01:34 PM
  2. Delete rows if column A has more than X words
    By sami770 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2015, 05:56 PM
  3. [SOLVED] Delete rows downwards with selected words
    By jantonio in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2013, 10:43 AM
  4. Delete Everything Except Rows with Key Words
    By aclark711 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2013, 04:07 PM
  5. How to delete rows that has X amount of words in them?
    By sami770 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2012, 09:48 AM
  6. How to delete rows that are at least 10 words long?
    By sami770 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2012, 05:15 PM
  7. Delete rows containing certain words
    By GSmith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-19-2005, 12:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1