Copy and Sort Unique

C

cranen

I have a list of item numbers in column “C†on Sheet 1. There are multiple
item numbers that are the same. In fact, the first two and sometimes more
are the exact same item number. My Summary Sheet (Sheet 2) is used to
calculate a quantity using a SUMIF statement dependent on the item number.
Well, I tried using a macro to copy and sort the unique values from column
“C†on sheet 1 to my Summary Sheet, but it continues to copy the top two
values which are the exact same. When this happens, it is messing up my
summary sheet. What is the best way to fix this? I appreciate your help.
Thanks.
 
E

eliano

I have a list of item numbers in column “C” on Sheet 1.  There are multiple
item numbers that are the same.  In fact, the first two and sometimes more
are the exact same item number.  My Summary Sheet (Sheet 2) is used to
calculate a quantity using a SUMIF statement dependent on the item number..  
Well, I tried using a macro to copy and sort the unique values from column
“C” on sheet 1 to my Summary Sheet, but it continues to copy the top two
values which are the exact same.  When this happens, it is messing up my
summary sheet.  What is the best way to fix this?  I appreciate your help.  
Thanks.

Hi cranen.
I dont know what is the best way, but try:

Public Sub prova()
Dim x As Long, y As Long
Sheets(1).Select
y = Range("C1").End(xlDown).Row
Range("C1").FormulaLabel = xlColumnLabels
Range("C1:C" & y & "").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets(2).Range("A1"), Unique:=True
Sheets(2).Select
x = Range("A1").End(xlDown).Row
Range("A1:A" & x & "").Sort Key1:=Range("A1"), Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
Range("A1").Select
End Sub

Change with your references and let us know.
Regards
Eliano
 
C

cranen

I tried plugging in my references, and I didn't have any luck. I might have
confused you with my previous request. All I need is a macro that copies and
sorts unique values from one column to a column in another worksheet without
copying the second value if it is the same as the first value. Thanks for
your help.
 

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