View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Remove duplicates from list using code

Hi,

Try this macro. Alt+F11 to open VB editor. Right click 'ThisWorkbook' and
insert module and paste the code in and run it. Change the sheet name to the
correct one.


Sub Copy_B_To_C()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet1")
With ws
.Columns("B:B").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=.Range("C1"), Unique:=True
End With
End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"michelle439731" wrote:

Yes, that is what I want to do. Look at column B, which contains duplicates,
copy all unique parameters to column C, such that column C contains no
duplicates.

How do I do that in code? What is the command?

Thank you very much for your help,

Michelle