Results 1 to 6 of 6

Highlight duplicate rows excluding column and vice versa another column

Threaded View

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Highlight duplicate rows excluding column and vice versa another column

    Hello everyone
    I have a great code for Mr. Karedog that highlights the duplicate rows with different colors ... It is working great and wonderful
    I need to make some little changes ..

    As for the attachment for example the whole range is D2:H11 ..
    column D is not important for me as it will not be duplicated .. the columns E:H is the important for me
    Columns F:H is no problem .. if all found from F:H are the same so it would be treated as duplicates

    The problem is for column E .. the duplicates would be for positive and negative values so (1 and -1 are considered duplicates)
    Here' the code and I hope it is clear
    Sub Karedog()
        Dim coll As New Collection, rng As Range, rngDelete As Range, arr, C As Long, I As Long, strKey As String, v1
    
        Set rng = Range("E2").CurrentRegion
        rng.Offset(1).Interior.ColorIndex = xlNone
        arr = rng.Value
    
        For I = 2 To UBound(arr, 1)
            strKey = arr(I, 1) & Chr$(2) & arr(I, 2) & Chr$(2) & arr(I, 3) & Chr$(2) & arr(I, 4)
                On Error Resume Next
                    coll.Add Key:=strKey, Item:=New Collection
                On Error GoTo 0
            coll(strKey).Add I
        Next I
    
        For Each v1 In coll
            If v1.Count > 1 Then
                C = RGB(Int(Rnd * 256), Int(Rnd * 256), Int(Rnd * 256))
                For I = 1 To v1.Count
                    rng.Rows(v1(I)).Interior.Color = C
                    If I > 1 Then
                        If rngDelete Is Nothing Then Set rngDelete = rng.Rows(v1(I)) Else Set rngDelete = Union(rngDelete, rng.Rows(v1(I)))
                    End If
                Next I
            End If
        Next v1
    End Sub
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to swop data in a table with the column field and vice versa?
    By damienchew in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2014, 12:18 AM
  2. how do i turn column letters to numbers and vice versa
    By intothewild in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2014, 08:27 AM
  3. [SOLVED] Change a table (col to rows and vice versa)
    By masben in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-29-2013, 06:32 AM
  4. Replies: 1
    Last Post: 02-01-2013, 03:38 PM
  5. Replies: 4
    Last Post: 03-31-2010, 09:54 PM
  6. [SOLVED] I want columns of worksheet to become rows and vice-versa.
    By Swapping rows and columns in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-10-2006, 01:10 AM
  7. [SOLVED] How do I change rows content to column & vice versa Excel spread s
    By Harinath in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-13-2005, 06:06 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