- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 255
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-25
|
¥»©«³Ì«á¥Ñ Hsieh ©ó 2016-4-29 23:56 ½s¿è
¦^´_ 2# colinyang
ª½Ä±¬OCombobox3²M³æ·|¨Ì¾ÚCombobox1¡ACombobox2¤º®eÅÜ°Ê
¿ï©w«á«ö¤U«ö¶s¨Ì§Ç¿é¤J- Public d2
- Private Sub ComboBox1_Change()
- ex
- End Sub
- Private Sub ComboBox2_Change()
- ex
- End Sub
- Private Sub ComboBox4_Change()
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- Set d2 = CreateObject("Scripting.Dictionary")
- fs = ThisWorkbook.Path & "\data.xlsx" '½Ð±N2Àɮשñ¦b¦P¤@¥Ø¿ý
- Set databook = Workbooks.Open(fs)
- With databook.Sheets(ComboBox4.Text)
- For Each a In .Range(.[A2], .[A2].End(xlDown))
- d(a.Value) = "" 'AÄ椣«½Æ²M³æ
- d1(a.Offset(, 1).Value) = "" 'BÄ椣«½Æ²M³æ
- d2(a & a.Offset(, 1)) = IIf(d2(a & a.Offset(, 1)) = "", a.Offset(, 2), d2(a & a.Offset(, 1)) & "," & a.Offset(, 2)) 'A&BÄæ²M³æ¤º®e
- Next
- ComboBox1.List = d.keys
- ComboBox2.List = d1.keys
- End With
- databook.Close 0
- End Sub
- Private Sub CommandButton1_Click()
- Cells(Rows.Count, 2).End(xlUp).Offset(1).Resize(, 3) = Array(ComboBox1, ComboBox2, ComboBox3) '¿é¤J¸ê®Æ
- End Sub
- Private Sub UserForm_Initialize()
- fs = ThisWorkbook.Path & "\data.xlsx" '½Ð±N2Àɮשñ¦b¦P¤@¥Ø¿ý
- Set databook = Workbooks.Open(fs)
- For Each sh In databook.Sheets
- ComboBox4.AddItem sh.Name
- Next
- databook.Close 0
- End Sub
- Sub ex()
- mystr = ComboBox1 & ComboBox2
- If d2(mystr) <> "" Then ComboBox3.List = Split(d2(mystr), ",") 'Combobox3ªº²M³æ
- End Sub
½Æ»s¥N½X |
|