code to match and sort
Anny
recording the actions and tidying up a bit (OK, a lot) gives this code:
Sub Macro2()
' assumes heading in row 1, columns A and B
Range("B1:B" & Range("B1").End(xlDown).Row).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("K1"), _
Unique:=True
Columns("K:K").Sort _
Key1:=Range("K2"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
Range("K1:K" & Range("K1").End(xlDown).Row).Copy
Range("M1").PasteSpecial _
Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
Columns("K:K").Clear
Range("M1").Clear
Application.CutCopyMode = False
End Sub
It assumes there is a heading in row1, columns A and B. It filters the
unique entries in column B, puts them in column K and sorts them. It then
copies them and transposes them into cell M1 and tidies up the intermediate
steps ... clears column K and cell M1.
If you have data in column E, you'll need to put the filtered Levels
somewhere else in the interim stages.
Regards
Trevor
"anny" wrote in message
...
help requested!!
Column A holds a value of Div1, Div2 or Div3
Column B holds a value from Level1 to Level6
Repeats in either column are allowed. A sample is shown below.
I need to place (in N1, O1, P1,...) the UNIQUE Levels in Division 1 (no
doubles), preferably in alpha order.
In the example, this would be Level2, Level3, Level5
A B ... N O P ...
Div1 Level5 Level2 Level3 Level5
Div1 Level2
Div2 Level5
Div3 Level2
Div1 Level5
Div1 Level3
Div2 Level6
This is part of a process that I currently do manually. I'd love to do
this by code, but I'm really stuck.
Thank you in advance for any assistance.
anny
|