Results 1 to 5 of 5

Finding Unique Values In Multiple Columns and Removing Them

Threaded View

  1. #1
    Registered User
    Join Date
    12-13-2014
    Location
    Boston, MA
    MS-Off Ver
    MS Office 2013
    Posts
    53

    Finding Unique Values In Multiple Columns and Removing Them

    Hello everyone,

    I think I'm making an easy task into a difficult one here. I want to use a macro (no advanced filter or conditional formatting) to compare cells in one range against cells in four other columns and remove the unique names from the four columns. Essentially this will be scrubbing an old roster of names against a new updated version.

    I've tried to do this using a "find duplicates" macro but I'm having trouble deleting the old column and replacing it with the new non-unique range. The pastespecial action errors out. I'm assuming this isn't the best approach. Any and all help is appreciated.


    Sub Compare()
    Dim Range1 As Range, Range2 As Range, Rng1 As Range, Rng2 As Range, outRng As Range
    xTitleId = "Remove Terminated Associates"
    Set Range1 = Application.Selection
    Set Range1 = Application.InputBox("Critical Roles Range :", xTitleId, Range1.Address, Type:=8)
    Set Range2 = Application.InputBox("Range2:", xTitleId, Type:=8)

    Application.ScreenUpdating = False
    For Each Rng1 In Range1
    xValue = Rng1.Value
    For Each Rng2 In Range2
    If xValue = Rng2.Value Then
    If outRng Is Nothing Then
    Set outRng = Rng1
    Else
    Set outRng = Application.Union(outRng, Rng1)
    End If
    End If
    Next
    Next
    outRng.Select
    Selection.Copy

    Range1.ClearContents
    Range1.PasteSpecial Paste:=xlPasteValues

    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Finding Unique List of Data pulled from multiple columns (Plus sum)
    By emdoak in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-09-2015, 10:45 AM
  2. Finding unique groups of values in columns
    By colmoshea in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 12-17-2013, 10:44 AM
  3. Finding Unique Values in two columns
    By pmfresno in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2012, 09:05 AM
  4. Replies: 5
    Last Post: 04-21-2011, 05:22 PM
  5. Finding Unique Values across four columns.
    By barksmith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2009, 02:23 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