Hello,
I have an excel table with several columns two of which I am interested in. What I am trying to do is filter the first column with a specific criterion and then copy the visible values from the other column into a range object. After that I need to remove duplicates. The problem is I get an error. Here's the code. There are a lot of duplicates. Please tell me what's wrong or suggest a better way to achieve the task I'm trying to do.
Thanks![]()
Sub Begin() Dim tbl As ListObject Set tbl = Worksheets("Sheet1").ListObjects("Table1") WorkSheet.AutoFilterMode = False tbl.Range.AutoFilter Field:=8, Criteria1:="DUKESTREET_II-2" Dim rng1 As Range Set rng1 = tbl.ListColumns("TGT CELL NAME").DataBodyRange.SpecialCells(xlCellTypeVisible) MsgBox rng1.Count rng1.RemoveDuplicates Columns:=1, Header:=xlNo MsgBox rng1.Count End Sub
Bookmarks