filter column

steve_bris

Registered User.
Local time
Today, 21:09
Joined
Mar 22, 2005
Messages
30
Hi.

I am manipulating Excel throught access VBA and I was wondering if there is there a way to filter a column into just the unique cells and not have any repeated. I have attached a file and the in Column A there is 4 names repeated many times...........I would like to write some code so that it manipulates this column and gets rid of all the repeated names and just ends up with the 4 unique ones.....like column C in the attached file.

Thanks for any Help.
Steve
 

Attachments

Last edited:
Filter it in place like this:
Range.AdvancedFilter Action:=xlFilterInPlace, Unique:=True

Remove filter:
sheet.ShowAllData

Paste the unique list elsewhere:
Range.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("C1"), Unique:=True


Is that what you're looking for?
 
Thanks Sergeant....tht should work , but it doesn't...I end up wit a couple of the list repeated......no idea why :(
 
Yeah, I tried it with your workbook, and as you say, it left a duplicate.
It's treating your first row as a header, and strangely the method has no argument for this. If you insert column headings, it will work fine.
If you make a procedure for this, make sure you provide some error control in case there is an insufficient selection (Runtime error 1004).
 

Users who are viewing this thread

Back
Top Bottom