As I don't understand the solution provided, I am attaching my attempt hoping for a little direction. My attempt copies the data from the previous page but I still can't get column D to produce.
Sub MoveData()
Dim LR As Long, a As Long, NR As Long
Dim ws1 As Worksheet, ws2 As Worksheet
Application.ScreenUpdating = False
Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
ws2.Cells.ClearContents
LR = ws1.Cells(Rows.Count, 1).End(xlUp).Row + 1
NR = 2
For a = 2 To LR + 1 Step 1
Application.CutCopyMode = False
ws2.Cells(NR, 1) = ws1.Cells(a, 1)
ws2.Cells(NR, 2) = ws1.Cells(a, 2)
ws2.Cells(NR, 3) = ws1.Cells(a, 3)
If ws1.Cells(a, 1) = ws1.Cells(a - 1, 1) Then
ws2.Cells(NR, 4) = ws1.Cells(a - 1, 4)
ElseIf ws1.Cells(a, 1) <> ws1.Cells(a - 1, 1) Then
ws2.Cells(NR, 4) = ws1.Cells(a, 4)
End If
NR = NR + 1
Next a
ws2.UsedRange.Columns.AutoFit
ws2.Select
Application.ScreenUpdating = True
End Sub
This is based on the active sheet being sorted with Column C from most to least.
Thank you.
Bookmarks