Hello everybody
I have three columns A - B - C with values ..
I want in Range("E1") to create validation list of distinct values of the three columns using vba ??
Hello everybody
I have three columns A - B - C with values ..
I want in Range("E1") to create validation list of distinct values of the three columns using vba ??
I tried this code
But It doesn't work for me .. I don't know why?Sub Unique() Dim r As Range, cel As Range, cell As Range Dim d, a Dim LR As Long, LastRow As Long, X As Long, Y As Long LR = Range("A" & Rows.Count).End(xlUp).Row Set r = Range("A1:C" & LR) On Error Resume Next Set d = CreateObject("Scripting.Dictionary") For Each cel In r If cel <> 0 Then d.Add CStr(cel), CStr(cel) Next a = d.items With Range("E1").Validation .Delete .Add Type:=xlValidateList, Formula1:=Application.Transpose(a) End With End Sub
Try this one..
Sub Unique() Dim DEB As Range Set DEB = Range("a1:c" & Range("A" & Rows.Count).End(xlUp).Row) For Each cel In DEB If InStr(RAJ & ",", "," & cel & ",") = 0 Then RAJ = RAJ & "," & cel Next cel With Range("e1").Validation .Delete .Add xlValidateList, 1, 1, Mid(RAJ, 2) End With End Sub
Regards!
=DEC2HEX(3563)
If you like someone's answer, click the star to give them a reputation point for that answer...
Thank you very much Mr. Debraj Roy
You are very helpful
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks