Hi all,
Code:
Sub Lil2606()
Dim Data As Range, delRng As Range
Dim DictKey As String
Dim Dict As New Scripting.dictionary
Dict.CompareMode = TextCompare
For Each Data In Sheet1.ListObjects("Table1").ListColumns("First name").DataBodyRange
DictKey = Join(Range("Table1([First name], [Surname], [Fruit])", "|"))
If Not Dict.Exists(DictKey) Then
Dict.Add DictKey, Nothing
Else
If delRng Is Nothing Then Set delRng = Data.Resize(, ListColumns.Count) Else Set delRng = Union(delRng, Data.Resize(, ListColumns.Count))
End If
Next Data
If Not delRng Is Nothing Then delRng.Delete
End Sub
Just debugging at the minute so more issues may come up, but at the minute
DictKey = Join(Range ... etc.) is the row highlighted, saying Run-time Error 1004, Method 'Range' of object '_Global' failed...
I really would like to refer to the table columns by their headers as it would make sure it doesn't matter if the data it is in workbook column A B or so..
Please help?
Bookmarks