I just realised my code is not what i thought it was.
it works well to remove duplicate rows...
But...
if in column A, there is a date or number or something else? perhaps anything but text
....it treats column A as the criteria for looking at duplicates.
for example, leaving only 1 line for each date, even though....the rows are different.
How can i change this code, so that it is an "authentic"
"duplicate row remover"
nothwithstanding what is happening with cell format in column A, or in any column.
just simply removing the duplicate rows on the active sheet, and leaving one of each of the original rows
Thanks in advance.
it works well to remove duplicate rows...
But...
if in column A, there is a date or number or something else? perhaps anything but text
....it treats column A as the criteria for looking at duplicates.
for example, leaving only 1 line for each date, even though....the rows are different.
How can i change this code, so that it is an "authentic"
"duplicate row remover"
nothwithstanding what is happening with cell format in column A, or in any column.
just simply removing the duplicate rows on the active sheet, and leaving one of each of the original rows
Thanks in advance.
VBA Code:
Option Explicit
Sub RemoveDuplicatesRows()
Dim AB As Long
AB = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim dataRange As range
Dim colNum As Variant
Dim I As Integer
Set dataRange = selection
ReDim colNum(0 To dataRange.Columns.Count - 1)
For I = 0 To UBound(colNum)
colNum(I) = I + 1
Next I
dataRange.RemoveDuplicates Columns:=(colNum), Header:=xlYes
Dim lastRow As Long
lastRow = ActiveSheet.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
MsgBox "to start with......" & AB & vbNewLine & "remaining are......" & lastRow
Set dataRange = Nothing
Set colNum = Nothing
End Sub
Last edited: