حفظك الله استاذنا الغالى
Option Explicit
Dim col As Object
Dim ro%, i%
Dim Sh As Worksheet
'++++++++++++++++++++++++++++++++++
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, Range("m:m")) Is Nothing _
And Target.Count = 1 Then
data_val
Cells(2, "e") = Target
End If
Application.EnableEvents = True
End Sub
'+++++++++++++++++++++++++++++++++++++++++
Sub data_val()
Set Sh = Sheets("Sheet1")
ro = Sh.Cells(Rows.Count, 1).End(3).Row
Set col = CreateObject("System.Collections.Arraylist")
With Sh
For i = 2 To ro
If .Cells(i, 1) <> vbNullString And _
Not col.Contains(.Cells(i, 1).Value) Then
col.Add .Cells(i, 1).Value
End If
Next i
With .Range("E2:E50").Validation
.Delete: .Add 3, Formula1:=Join(col.toarray, ",")
End With
End With
End Sub
تم التنفيذ وايضا الكود توقف
اشكرك من قلبى