Hello:
Please refer to attached file.
I am using below code succesfully to get unique names from column B into Row 2 staring in cell E2 as shown.
Sub SortEmployee()
Range("E2").Resize(1, Columns.Count - 13).ClearContents
If MsgBox("Do you want to run the macro", vbYesNo) = vbNo Then Exit Sub
Application.ScreenUpdating = False
With Range("B1", Cells(Rows.Count, 2).End(xlUp))
.AdvancedFilter xlFilterInPlace, , , True
.Offset(1).Copy ' cell C1 is header of column C
[E2].PasteSpecial xlPasteValues, xlNone, False, True
.AutoFilter: .AutoFilter
End With
With Selection
.Sort Key1:=.Cells(1), Order1:=xlAscending, Orientation:=xlLeftToRight
End With
Application.ScreenUpdating = True
End Sub
What i want is to have cell j2:Z2 = 0 in this case.
If i had names until P2, then Q2:Z2 = 0.
Please help modify the above code to add this feature.
Let me know if you have any questions.
Thanks.
Riz
Bookmarks