» Return unique items using VBA in Microsoft Excel
VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions
CATEGORY - Custom Functions , Printing in VBA
VERSION - All Microsoft Excel Versions
The macro below will return all the unique items from a range to another range. You can use the macro like this to copy all the unique items from A2:A100 to cell C1 and below:
FindUniqueValues Range("A2:A100"), Range("C1")
Sub FindUniqueValues(SourceRange As Range, TargetCell As Range)
SourceRange.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=TargetCell, Unique:=True
End Sub
Book Store:
Recommended Books:
- Microsoft Excel 2002 Simply Visual
- Accounting Principles, with CD, 6th Edition
- Microsoft Office Xp: Advanced Concepts and Techniques: Word 2002, Excel 2002, Access 2002, Powerpoint 2002
- Analyzing Markets, Products, and Marketing Plans
- Yes, You Can Time the Market!
- The McGraw-Hill Guide to Writing a High-Impact Business Plan: A Proven Blueprint for First-Time Entrepreneurs
No comments have been submitted.

