Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy and Sort Unique
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. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy and Sort Unique
On 13 Ago, 23:24, cranen wrote:
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy and Sort Unique
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. "eliano" wrote: On 13 Ago, 23:24, cranen wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Attempting to sort unique/only count first record in each unique g | Excel Discussion (Misc queries) | |||
how do I find and sort unique values from a column | Excel Worksheet Functions | |||
How to Sort by Count the Max nos of Unique text values in Pivot Ta | Excel Discussion (Misc queries) | |||
copy only unique values | Excel Worksheet Functions | |||
How do I sort a column a unique number? | Excel Worksheet Functions |