i have a list of items in a column. some items may be the same and gets repeated in the came column.
I want to extract every item name in another spreadsheet column only once so that those duplicates will not be repeated again.
Is it possible?
i have a list of items in a column. some items may be the same and gets repeated in the came column.
I want to extract every item name in another spreadsheet column only once so that those duplicates will not be repeated again.
Is it possible?
Look at Data>Filter>ADvanced Filter, it has an option for Unique Entries.Originally Posted by sebas1102
yup but i need it in macro to add to another sheet so that there will be no duplicates... i need to collate data. i need to do a countif in a new sheet and if counif>0 in the 2nd sheet means the item has already been added so it can proceed on to the next row.
Can u help me? i am very lost...
You can still use Advaned filter - trick is to start from the target sheet - record yourself setting it up to get code - it's pretty straightforward.
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com
=( still cannot be done bcos it is different workbook....*pluck hair*
Not sure of the details of what you want to do here, but you can use collections to extract unique items e.g.Originally Posted by sebas1102
[vba]Option Explicit
'
Sub GetUniqueItems()
'
Dim UniqueItem As Collection, Cell As Range, N As Long
'
Set UniqueItem = New Collection
'
Application.ScreenUpdating = False
'
On Error Resume Next
'get all the unique items in column A
For Each Cell In Range("A1", Range("A" & Rows.Count).End(xlUp))
'can't have duplicates in a collection
UniqueItem.Add CStr(Cell), CStr(Cell)
Next
'
'put the unique items in column B
For N = 1 To UniqueItem.Count
Range("B" & N) = UniqueItem(N)
Next
Application.ScreenUpdating = True
'
End Sub[/vba]
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.
You seem to be looking for excuses. You didn't say it was a different workbook but, anyway, it *can* still be done. Have you tried it?Originally Posted by sebas1102
Enjoy,
Tony
---------------------------------------------------------------
Give a man a fish and he'll eat for a day.
Teach him how to fish and he'll sit in a boat and drink beer all day.
I'm (slowly) building my own site: www.WordArticles.com