Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
/ulf,
Sub KeepLowestRow() Dim myRow As Long myRow = Cells(Rows.Count, 2).End(xlUp).Row Range("C1").EntireColumn.Insert Shift:=xlToRight Range("C1:C" & myRow).FormulaR1C1 = "=COUNTIF(R1C2:RC[-1],RC[-1])" Range("C1:C" & myRow).AutoFilter Field:=1, Criteria1:="<1" Range("C2:C" & myRow).SpecialCells(xlCellTypeVisible).EntireRow.D elete Range("C2:C" & myRow).AutoFilter Range("C2").EntireColumn.Delete End Sub HTH, Bernie MS Excel MVP "ulfb" wrote in message ... Sorry - let me try to explain more carefully_ - I need to keep rows with lowest row number after sorting on B and M (sometimes another cols) and delete possible other rows with same id. Deleted rows should not leave empty rows. - processing is automated - sub should be called from other sub with no user involvment thank you! /ulf "Bernie Deitrick" wrote: Keep the lowest number, based on the value in which column? Should be controlled by code - not a manually started macro. What do you mean by that? Bernie MS Excel MVP "ulfb" wrote in message ... Hi Amateur needs some help please: Sheet40, col B contains item id:s - I need to keep lowest numbers and delete all duplicate rows, which can be one or more. Should be controlled by code - not a manually started macro. Understand I should start with sorting - but then? /ulf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting duplicate rows | Excel Discussion (Misc queries) | |||
Deleting duplicate rows | Excel Discussion (Misc queries) | |||
Deleting duplicate rows | Excel Programming | |||
Deleting Duplicate Rows | Excel Programming | |||
Deleting Duplicate Rows | Excel Programming |