|
发表于 2015-6-13 23:21
|
显示全部楼层
本楼为最佳答案
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim ar, d
- Set d = CreateObject("scripting.dictionary")
- With Sheets("Sheet1")
- ar = .Range("A1:a" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
- End With
- For i = 1 To UBound(ar)
- d(ar(i, 1)) = ""
- Next
- If Target.Column = 1 Then
- With Target.Validation
- .Delete
- .Add Type:=xlValidateList, Formula1:=Join(d.keys, ",")
- End With
- End If
- End Sub
复制代码 下拉去重的
|
|