Hello:
Please refer to attached sheet.
I am using the code below to find unique names from list in column A.
(The code does find Unique names successfully.)
Once unique name is found, i need to sort out Ascending order.
For some reason, it is not sorting ascending correctly.
Please help and modify the code below so that the sorted unique names are pasted in column D.
Sub employees_Row1()
'Range("K1").Resize(1, Columns.Count - 10).ClearContents
Range("D1").Resize(1, Columns.Count - 4).ClearContents
'Range("AA3").Resize(Rows.Count, 1).ClearContents
If MsgBox("Do you want to run the macro", vbYesNo) = vbNo Then Exit Sub
Application.ScreenUpdating = False
With Range("B2", Cells(Rows.Count, 2).End(xlUp))
.AdvancedFilter xlFilterInPlace, , , True
.Offset(1).Copy ' cell C1 is header of column C
[D2].PasteSpecial xlPasteValues
'[AA1].PasteSpecial xlPasteAll, xlNone, False, True
.AutoFilter: .AutoFilter
End With
With Selection
.Sort Key1:=.Cells(1), Order1:=xlAscending, Orientation:=xlLeftToRight
End With
Application.ScreenUpdating = True
End Sub
Please let me know if any questions.
Thank you
Riz Momin
Bookmarks