Results 1 to 5 of 5

Delete a Cell in Worksheet1 That Appears in Worksheet2

Threaded View

  1. #3
    Registered User
    Join Date
    04-27-2008
    Posts
    11

    Re: Delete a Cell in Worksheet1 That Appears in Worksheet2

    Here's the macro that compared column A of worksheet1 with column A of worksheet2. If only I could amend this to compare to all columns of worksheet2.

    Sub DeleteEmails()
        Dim rList As Range
        Dim rCrit As Range
         
        With Worksheets("Sheet1")
            Set rList = .Range("A1", .Cells(Rows.Count, 1).End(xlUp))
        End With
        With Worksheets("Sheet2")
            Set rCrit = .Range("A1", .Cells(Rows.Count, 1).End(xlUp))
        End With
         
        rList.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=rCrit, Unique:=False
        rList.Offset(1).SpecialCells(xlCellTypeVisible).Delete shift:=xlUp
        Worksheets("Sheet1").ShowAllData
         
        Set rList = Nothing
        Set rCrit = Nothing
    End Sub
    Last edited by davesexcel; 10-22-2012 at 08:21 PM. Reason: Code tags required when showing VBA code, please read the forum rules

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