Excel 2007: Collect unique values from several columns
Filed in Excel on Oct.26, 2007. Email This article to a Friend
This macro creates, in column 10, unique values from an area you previously selected. Duplicate values are deleted in the new list.
Instructions:
Create Macro:
- Click "Office button" (button at the top left side of excel)
- Click "Excel options"
- Click "Popular"
- Click "Show developer tab in the ribbon"
- Press ok!
- Click "Developer" tab in the ribbon
- Click "Macros" button
- Type a new name for the macro
- Click "Create" button
- Copy this:
For Each Cell In Selection
If Application.CountIf(Columns(10), Cell) = 0 Then Cells(65536, 10).End(xlUp).Offset(1, 0) = CellEnd If
Next Cell
- Paste it between Sub Macro_name() and End Sub
- Exit "Visual Basic"
How to use macro:
- Select the values you want to create a unique list from
- Click "Macros" in Developer tab
- Select and run Macro

Related blog posts
- Insert a new row at the top every time a value has been entered
- Categorize values into multiple columns using vba in excel
- Excel toolbox: Save your custom functions and macros in an Add-In
- Highlight unique values and unique distinct values in a range using conditional formatting in excel
- Create a unique distinct list of a long list without sacrificing performance using vba in excel






Leave a Reply