Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim res, lr As Long, ws As Worksheet
If Not Intersect(Target, Range("B6")) Is Nothing Then
Application.EnableEvents = False
Call ADD_DVlist(Target)
Range("B6").Validation.Delete
Range("B6").Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Formula1:="=DV_List"
End If
Application.EnableEvents = True
End Sub
Insert in Sheet1 module: righ click on tab, "View code", copy/past code
In standard module
Option Explicit
Sub ADD_DVlist(tValue)
Dim res, lr As Long, ws
res = Application.Match(tValue, Range("DV_LIST"), 0)
If IsError(res) Then ' New entry so update DV List
Set ws = Sheets("sheet2")
With ws
lr = .Cells(Rows.Count, "A").End(xlUp).Row + 1
.Cells(lr, 1) = tValue
.Range("A1:A" & lr).Sort Key1:=.Range("A1"), Order1:=xlAscending, Header:=xlNo
End With
End If
End Sub
to add new names, simply type in B6
Bookmarks