+ Reply to Thread
Results 1 to 5 of 5

Remove duplicate from rows from specific cell/row number to specific cell/row number

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Remove duplicate from rows from specific cell/row number to specific cell/row number

    Hi,

    I have the some data in sheet “DATA” where I have table with headings Tag, URM-1, URM-2, URM-3 etc.

    Every tag contains multiple URM’s in each row.
    Need vba code to remove duplicates contains from URM-1 to URM-7 only against “Tag” in individual rows and wants the result in new sheet “RESULT”

    For example in sheet “DATA”

    In row 2 against tag “JIOVNAU18349” there are three URMs. Against 3 URM 2 URMs are duplicate and one URM is Unique. Hence I want to keep the unique URM’s in ROW 2.

    Do not remove duplicates in “Tag” Duplicates should be removed from Column URM-1 to URM-7. Please provide provision to change URM columns to remove duplicates. Means to remove duplicate urm from URM-1 to URM-7 OR URM-3 to URM-5, etc.

    Please note I want the result in NEW SHEET.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Remove duplicate from rows from specific cell/row number to specific cell/row number

    this can do it

    Sub test()
    Dim r As Integer, lr As Long, lc As Long
    lr = Sheets("Data").UsedRange.Rows.Count
    lc = Sheets("Data").UsedRange.Columns.Count
    ReDim sn(1 To lr, 1 To lc)
    With Sheets("Data")
        For x = 1 To lr - 2
            For i = 1 To lc
                r = Application.CountIf(.Range(.Cells(x, 2), .Cells(x, i)), .Cells(x, i))
                If r = 1 Then
                    sn(x, i) = "'" & .Cells(x, i)
                ElseIf r <> 1 Then
                    sn(x, i) = ""
                End If
            Next i
        Next x
    End With
    Sheets.Add After:=Sheets(Sheets.Count)
    Sheets(Sheets.Count).Range("A1").Resize(UBound(sn) - 1, lc) = sn
    Sheets(Sheets.Count).Columns.AutoFit
    End Sub
    Kind regards
    Leo
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Remove duplicate from rows from specific cell/row number to specific cell/row number

    This should do
    Sub test()
        Dim i As Long
        With Sheets("data").Cells(1).CurrentRegion
            For i = 2 To .Rows.Count
                .Rows(i).Value = .Parent.Evaluate("if(countif(offset(" & .Rows(i).Address & ",,,,column(" & _
                    .Rows(i).Address & "))," & .Rows(i).Address & ")=1," & .Rows(i).Address & ","""")")
            Next
        End With
    End Sub

  4. #4
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Remove duplicate from rows from specific cell/row number to specific cell/row number

    Hey Thank you so much for the code

  5. #5
    Forum Contributor
    Join Date
    11-17-2015
    Location
    India
    MS-Off Ver
    2013
    Posts
    365

    Re: Remove duplicate from rows from specific cell/row number to specific cell/row number

    hi can you please provide code for below thread.
    http://www.excelforum.com/excel-prog...ml#post4285701

+ 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. [SOLVED] Specific character of a cell to display as specific number on another cell
    By excellenct in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-13-2015, 11:45 AM
  2. [SOLVED] Show contents of cell, number of rows away from a specific cell
    By bluecat2013 in forum Excel General
    Replies: 2
    Last Post: 10-29-2014, 12:22 PM
  3. [SOLVED] how to stop Command button If specific number is entered in a specific cell range
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2013, 05:10 AM
  4. VBA to remove formulas from specific number columns (number changes each week)
    By DKerr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2013, 06:41 AM
  5. Search for specific data and count number of rows till empty Cell
    By kjanani30 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2013, 06:05 AM
  6. Hide specific columns dependant on number in specific cell
    By ladbroke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 04:46 PM
  7. Replies: 3
    Last Post: 01-21-2009, 05:37 AM

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