Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook with duplicate rows where multiple columns may remain the
same, but column F may change from row to row. I'm trying to delete all rows that are direct duplicates of the row above it so I can view just the rows where column F is different (if all other columns are similar as row above.) Thanks for any assistance! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there,
Try the following: Sub DeleteDublicatedRowsAtoE() Dim Sht As Worksheet Dim ColsStr1 As String, ColsStr2 As String Dim LastRow As Long Dim i As Long Set Sht = ThisWorkbook.Worksheets("Sheet1") With Sht LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row For i = LastRow To 2 Step -1 ColsStr1 = _ .Cells(i, 1) & _ .Cells(i, 2) & _ .Cells(i, 3) & _ .Cells(i, 4) & _ .Cells(i, 5) ColsStr2 = _ .Cells(i - 1, 1) & _ .Cells(i - 1, 2) & _ .Cells(i - 1, 3) & _ .Cells(i - 1, 4) & _ .Cells(i - 1, 5) If ColsStr1 = ColsStr2 Then .Rows(i).Delete Next i End With End Sub "jscorsone" wrote in message ... I have a workbook with duplicate rows where multiple columns may remain the same, but column F may change from row to row. I'm trying to delete all rows that are direct duplicates of the row above it so I can view just the rows where column F is different (if all other columns are similar as row above.) Thanks for any assistance! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |