I understand, see if this will work. I havent tested but I think will work for you.
Sub Macro3()
On Error GoTo Terminate
Dim UniqueValues As New Collection
Dim AllCells As Range, Cell As Range
Application.ScreenUpdating = False
Sheet6.Visible = True
pj = Range("C4")
Range("X:X").Clear
Range("X1") = "Users"
Sheet6.Select
ActiveSheet.Range("$A$1:$N$700").AutoFilter Field:=7, Criteria1:=pj
Range("D2:D100").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheet8.Select
Range("AB2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Find the last used row in a Column
Dim Lastrow As Long
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "X").End(xlUp).Row
End With
Set AllCells = ActiveSheet.Range("X2:X" & Lastrow)
' The next statement ignores the error caused
' by attempting to add a duplicate key to the collection.
' The duplicate is not added - which is just what we want!
On Error Resume Next
For Each Cell In AllCells
UniqueValues.Add Cell.Value, CStr(Cell.Value)
' Note: the 2nd argument (key) for the Add method must be a string
Cell.ClearContents
Next Cell
' Now due something with the sorted non-duplicated items
i = 2
For Each Item In UniqueValues
Cells(i, "X") = Item
i = i + 1
Next Item
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "X").End(xlUp).Row
End With
Rng = "=$X$2:$X$" & Lastrow & ""
Range("C5").Activate
Selection.UnMerge
Range("C5").Clear
Range("C5:G5").Select
Selection.Merge
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Rng
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
' Sheet6.Visible = False
Application.ScreenUpdating = True
Exit Sub
Terminate:
Sheet7.Activate
MsgBox "Name not in list", vbOKOnly + vbExclamation, "Ending inquiry"
Range("C5").Activate
Selection.UnMerge
Range("C5").Clear
Range("C4").Activate
Sheet6.Visible = False
End Sub
Bookmarks