junior_one

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
Private 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

 



posted on 2018-12-13 17:18  junior_one  阅读(242)  评论(0编辑  收藏  举报