Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have a variation on the removing duplicate rows problem: Given a sorted list of x rows with n columns each, The records are redundant if columns 1, 2 and 5-9 match. A string is created of the concatenated cells 1&2 (names)and compared, and this works fine. But I cannot get code to compare the ranges 5-9 with one another to work, I get a "type mismatch" error, even though the data types are exactly the same(dates). Thus the solution; Sub FixDuplicateRows() Dim RowNdx As Long Dim ColNum As Integer ColNum = Selection(1).Column For RowNdx = Selection(Selection.Cells.Count).Row To _ Selection(1).Row + 1 Step -1 If Cells(RowNdx, ColNum).Value = Cells(RowNdx - 1, ColNum).Value Then Cells(RowNdx, ColNum).Value = "----" End If Next RowNdx End Sub (posted on Chip Pearson's page http://www.cpearson.com/excel/duplicat.htm) fails when I substitute the code: If (dateRng.Rows(RowNdx) = dateRng.Rows(RowNdx - 1)) Then dateTrue = True End If giving the "type mismatch error". Have tried comparing cell by cell, but am afraid that this will slow down runtime to an extent that it is probably just as efficient to leave the duplicates in! Any advice gratefully received, Matilda |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Removing duplicate rows | New Users to Excel | |||
removing duplicate rows | Excel Discussion (Misc queries) | |||
Add in for removing duplicate rows? | Excel Programming | |||
Removing Duplicate Rows | Excel Discussion (Misc queries) | |||
removing duplicate rows | Excel Programming |