|
- 工作表代码生成字典不重复值下拉框到表2
- 再由表单下拉控件定义名称动态引用
- Private Sub Worksheet_Activate()
- Dim arr1()
- Dim d, k, i%, j%, c
- Set d = CreateObject("Scripting.Dictionary")
- Set Sht1 = Sheet1
- Myr = Sht1.[a83836].End(xlUp).Row
- Arr = Sht1.Range("a5:a" & Myr)
- For i = 1 To UBound(Arr)
- d(Arr(i, 1)) = ""
- Next
- k = d.keys
- Sheet2.Range("a1").Resize(d.Count, 1) = Application.Transpose(k)
- Sheet2.Range("a1").Resize(d.Count).Sort Key1:=Sheet2.Range("a1"), Order1:=1, Header:=2
- End Sub
- ‘当下拉表单控件引用数据后生成需引用B列的对应数据
- Sub yyyy()
- Range("f5:f83836") = ""
- s = Sheet2.Range("a" & Range("f1"))
- Range("f4") = s
- For i = Range("e7") To Range("e8")
- If Cells(i, 1) = s And Cells(i, 2) <> "" Then
- n = n + 1
- Cells(n + 4, 6) = Cells(i, 2)
- End If
- Next
- End Sub
复制代码 |
评分
-
4
查看全部评分
-
|