|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Intersect([B3], Target) Is Nothing Then Exit Sub
- Dim arr, brr, i&, j&, k&, s
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- arr = Sheets("数据").Range("B1:B" & Sheets("数据").Cells(Sheets("数据").Rows.Count, "B").End(xlUp).Row)
- If Not IsArray(arr) Then Exit Sub
- For i = 2 To UBound(arr)
- If arr(i, 1) <> "" Then d(arr(i, 1)) = ""
- Next
- s = Join(d.keys, ",")
- With Target.Validation
- .Delete
- .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=s
- .ShowError = False
- End With
- Set d = Nothing
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|