Results 1 to 10 of 10

Macro Deletes all rows except....

Threaded View

TheDriver85 Macro Deletes all rows... 10-25-2012, 12:28 PM
jeffreybrown Re: Macro Deletes all rows... 10-25-2012, 12:32 PM
AB33 Re: Macro Deletes all rows... 10-25-2012, 12:35 PM
jeffreybrown Re: Macro Deletes all rows... 10-25-2012, 12:46 PM
TheDriver85 Re: Macro Deletes all rows... 10-25-2012, 01:59 PM
jeffreybrown Re: Macro Deletes all rows... 10-25-2012, 02:02 PM
AB33 Re: Macro Deletes all rows... 10-25-2012, 02:39 PM
jeffreybrown Re: Macro Deletes all rows... 10-25-2012, 02:47 PM
TheDriver85 Re: Macro Deletes all rows... 10-25-2012, 04:18 PM
jeffreybrown Re: Macro Deletes all rows... 10-25-2012, 06:37 PM
  1. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Macro Deletes all rows except....

    Try

    Sub DeleteUnwanted()
        Const TextToKeep As String = "DELV" '<-- Change to suit
        
        Application.ScreenUpdating = False
        With Range("C1", Range("C" & Rows.Count).End(xlUp))
            .AutoFilter Field:=1, Criteria1:="<>" & TextToKeep & "*"
            .Offset(1).EntireRow.Delete
            .AutoFilter
        End With
        Application.ScreenUpdating = True
    End Sub
    Last edited by jeffreybrown; 10-25-2012 at 12:53 PM. Reason: Updated the text to keep to a wildcard after
    HTH
    Regards, Jeff

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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