Results 1 to 6 of 6

Copy data from once cell on to rows with a duplicate value

Threaded View

  1. #5
    Registered User
    Join Date
    11-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copy data from once cell on to rows with a duplicate value

    I have moved my field which requires copying to the end and believe i have sorted it with the following - anybody who sees a glaring error which will hold me up in future - feel free to improve...thanks

    'Sort/Match column A values, merge all other cells into row format
    Dim LR As Long, i As Long
    Application.ScreenUpdating = False
    
    'Sort data
        LR = Range("S" & Rows.Count).End(xlUp).Row
        Range("S1").CurrentRegion.Sort Key1:=Range("S1"), Order1:=xlDescending, Header:=xlGuess
        
        
        
    'Group matching names
        For i = LR To 2 Step -1
            If Cells(i, "S").Value = Cells(i - 1, "S").Value Then
                Range(Cells(i - 1, "T"), Cells(i - 1, Columns.Count).End(xlToLeft)).Copy _
                    Cells(i, Columns.Count).End(xlToLeft).Offset(0, 0)
                Rows(i - 1).EntireRow.Delete (xlShiftUp)
            End If
        Next i
    
    Cells.Columns.AutoFit
    Application.ScreenUpdating = True
    End Sub
    Last edited by arlu1201; 11-26-2012 at 01:48 PM.

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