Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
If Target.Value = "Names1" Then
Call AddNames1
ElseIf Target.Value = "Names2" Then
Call AddNames2
ElseIf Target.Value = "" Then
Call RemoveNames
End If
End Sub
Sub AddNames1()
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Sheet1" Then
ws.Select
ws.Range("A1").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Names1" 'Change to your named range
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
Next ws
Sheets(1).Select
Application.ScreenUpdating = True
End Sub
Sub AddNames2()
Application.ScreenUpdating = True
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Sheet1" Then
ws.Select
ws.Range("A1").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Names2" 'Change to your named range
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
Next ws
Sheets(1).Select
Application.ScreenUpdating = True
End Sub
Sub RemoveNames()
Application.ScreenUpdating = True
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "Sheet1" Then
ws.Select
ws.Range("A1").Select
With Selection.Validation
.Delete
End With
End If
Next ws
Sheets(1).Select
Application.ScreenUpdating = True
End Sub