自动生成一列不重复数据库
时间:2021-07-01 10:21:17
帮助过:21人阅读
Sub Worksheet_Activate()
Dim d
As Object
Dim arr
Dim x
As Integer
Set d =
CreateObject(
"scripting.dictionary")
arr = Sheet1.Range(
"a2:a" & Sheet1.Cells(Rows.Count,
1).End(xlUp).Row)
For x =
1 To UBound(arr)
d(arr(x, 1)) =
""
Next
Sheets("Sheet2").Select
Range("C2").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=
Join(d.keys,
",")
‘.Add 3, 1, 1, Join(d.keys, ",")
End With
End Sub
自动生成一列不重复数据库
标签:validate cells val nbsp count row sele select span