|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 crazy0qwer 于 2013-4-9 03:11 编辑
- '---------------------------------------Sheet1 代码
- Private Sub ComboBox1_Change()
- Dim Ar, I As Long
- On Error Resume Next
- Ar = Split(D1(ComboBox1.Text), ",")
- ComboBox2.Clear
- For I = 0 To UBound(Ar)
- ComboBox2.AddItem Ar(I)
- Next
- End Sub
- Private Sub ComboBox2_Change()
- Dim Ar, I As Long
- Ar = Split(D2(ComboBox1.Text & ComboBox2.Text), ",")
- ComboBox3.Clear
- For I = 0 To UBound(Ar)
- ComboBox3.AddItem Ar(I)
- Next
- End Sub
- Private Sub Worksheet_Activate()
- Call auto_open
- End Sub
- '-----------------------------------------------------模块代码
- Public D1 As Object, D2 As Object
- Sub auto_open()
- Dim Ar, I As Long
- Ar = Worksheets("名单").[A1].CurrentRegion
- Set D1 = CreateObject("scripting.dictionary")
- Set D2 = CreateObject("scripting.dictionary")
- D1.RemoveAll
- D2.RemoveAll
- Worksheets("选择").ComboBox1.Clear
- For I = 2 To UBound(Ar)
- If D1.Exists(Ar(I, 4)) = False Then Worksheets("选择").ComboBox1.AddItem Ar(I, 4)
- D1(Ar(I, 4)) = IIf(InStr(D1(Ar(I, 4)), Ar(I, 7)) = 0, D1(Ar(I, 4)) & Ar(I, 7) & ",", D1(Ar(I, 4)))
- D2(Ar(I, 4) & Ar(I, 7)) = D2(Ar(I, 4) & Ar(I, 7)) & Ar(I, 3) & ","
- Next
- End Sub
复制代码
求助ActiveX控件设置.rar
(57.94 KB, 下载次数: 37)
|
|