Filtering, Removing Duplicates and Specific Data

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
@Fluff you helped me with this formula before and I was hoping you could explain each element so I can adjust it for other uses. For example I think I should be able to adjust the "If .exists(cl.Value) Then .Remove cl.Value" line to include ".removeduplicates" and then add code to paste the new data free from of duplicates to a new sheet. I'm also assuming I can expand the dictionary to include data from a range A:Z for example, yet use column M to check for duplicates.

Sub FilterData()
Dim cl As Range

With CreateObject("scripting.dictionary")
For Each cl In Range("B2", Range("B" & Rows.count).End(xlUp))
.Item(cl.Value) = Empty
Next cl
For Each cl In Sheets("sheet2").Range("A5:A40")
If .exists(cl.Value) Then .Remove cl.Value
Next cl
Range("B:B").AutoFilter 1, .keys, xlFilterValues
End With
End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top