Saturday, June 4, 2011

Unique Values Using Advance Filter

If you want to find the unique values in a list . Snapshot below -

Try this code (done it using Advance Filter)- 

Sub unique_values()
    'remove if any filter
    If Sheets("Main").FilterMode Then
    End If

'clear existing data if any in col K

'extract unique values
Sheets("Main").Range("a1:a" & Sheets("Main").Range("a65356").End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("Main").Range("k1"), Unique:=True

End Sub

Download Working File

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...