+ Reply to Thread
Results 1 to 3 of 3

Remove Duplicate Values and Blanks in Row

Hybrid View

  1. #1
    Registered User
    Join Date
    11-28-2012
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    8

    Remove Duplicate Values and Blanks in Row

    I was hoping someone might be able to assist me with creating a macro to remove duplicates and blanks across a row.

    There are groupings of image names starting in column B that are associated to a unique Group ID in column A. The images in the row will be up to 50 values long with a total of 50,000+ unique Group ID's. I was wondering if there is a way using a macro to have Excel remove duplicates in each row and any blanks between images.

    Attached is a file to give a basic visual of what the issue is. Sheet 1 shows the current format of the data and Sheet 2 shows the ideal outcome if possible. Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Remove Duplicate Values and Blanks in Row

    Hi

    Sub aaa()
      For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
        For j = Cells(i, Columns.Count).End(xlToLeft).Column To 2 Step -1
          If Len(Cells(i, j)) = 0 Or WorksheetFunction.CountIf(Range(Cells(i, 2), Cells(i, j)), Cells(i, j)) > 1 Then
            Cells(i, j).Delete shift:=xlToLeft
          End If
        Next j
      Next i
    End Sub
    rylo

  3. #3
    Registered User
    Join Date
    11-28-2012
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Remove Duplicate Values and Blanks in Row

    Worked perfectly, thank you very much!

+ Reply to Thread

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