Advanced Filter with multiple columns for Unique values

Doc203

New Member
Joined
Jan 23, 2011
Messages
32
I need to extract unique values, from more than one column, individually. What I mean is I have a column of "City" and another of "County" and I want to populate userfrom combo boxes with unique values of cities and counties. From what I can tell you can only use advanced filter once - here is what I have:

Code:
Sub unique_values_city()

Dim lastrow As Long
lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Sheets("Prospects").Select
Columns("AJ:AK").ClearContents
Range("C1:C" & lastrow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
        "AJ1"), Unique:=True
Range("F1:F" & lastrow).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
        "AK1"), Unique:=True
End Sub

City works fine, but County will only bring over the header row. Thanks for any ideas.
 
Last edited:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,651
Messages
6,120,742
Members
448,989
Latest member
mariah3

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