Unique value...macro requetsed

  • Thread starter Srinivasulu Bhattaram
  • Start date
S

Srinivasulu Bhattaram

I need a macro to do the following:

1. I have a spreadsheet with 10 rows and 7 columns (70 cells
totally).

2. These cells will be filled with values (X,Y,Z etc.).

3. I need to take the unique values alone from these cells and copy it
to another sheet in the same workbook.

I've been trying so many options (Data filter, formulas etc). Can any one
please help me out?

seena




---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 081029-0, 10/29/2008
Tested on: 10/30/2008 11:31:14 AM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
 
B

Bob Phillips

Sub Macro2()
Dim col As Collection
Dim val As Variant
Dim cell As Range
Dim i As Long

Set col = New Collection
On Error Resume Next
For Each cell In Selection

col.Add cell.Value, CStr(cell.Value)
Next cell

Worksheets.Add
i = 1
For Each val In col

Cells(i, "A").Value = val
i = i + 1
Next val
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top