- ©«¤l
- 1572
- ¥DÃD
- 16
- ºëµØ
- 2
- ¿n¤À
- 1521
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- office 2003
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2016-1-13
|
userform¤¤¡G- Private Sub ComboBox1_Change()
- With ComboBox2
- If InStr(d(ComboBox1.Value), ",") = 0 Then
- .Clear
- .AddItem d(ComboBox1.Value)
- Else
- .List = Split(d(ComboBox1.Value), ",")
- End If
- End With
- End Sub
-
- Private Sub ComboBox2_Change()
- With ComboBox3
- If InStr(d2(ComboBox1.Value & ComboBox2.Value), ",") = 0 Then
- .Clear
- .AddItem d2(ComboBox1.Value & ComboBox2.Value)
- Else
- .List = Split(d2(ComboBox1.Value & ComboBox2.Value), ",")
- End If
- End With
- End Sub
- Private Sub ComboBox3_Change()
- With Sheet1
- rng = .UsedRange
- For i = 2 To UBound(rng)
- If rng(i, 1) & rng(i, 2) & rng(i, 3) = ComboBox1.Value & ComboBox2.Value & ComboBox3.Value Then
- x = x + rng(i, 4)
- End If
- Next
- TextBox1.Value = x
- End With
- End Sub
- Private Sub UserForm_Initialize()
- Set d = CreateObject("Scripting.Dictionary")
- Set d2 = CreateObject("Scripting.Dictionary")
- With Sheet1
- rng = .UsedRange
- For i = 2 To UBound(rng)
- If d(rng(i, 1)) = "" Then
- d(rng(i, 1)) = rng(i, 2)
- Else
- If InStr(d(rng(i, 1)), rng(i, 2)) = 0 Then
- d(rng(i, 1)) = d(rng(i, 1)) & "," & rng(i, 2)
- End If
- End If
- If d2(rng(i, 1) & rng(i, 2)) = "" Then
- d2(rng(i, 1) & rng(i, 2)) = rng(i, 3)
- Else
- If InStr(d2(rng(i, 1) & rng(i, 2)), rng(i, 3)) = 0 Then
- d2(rng(i, 1) & rng(i, 2)) = d2(rng(i, 1) & rng(i, 2)) & "," & rng(i, 3)
- End If
- End If
- Next
- ComboBox1.List = d.keys
- End With
- End Sub
½Æ»s¥N½X Module¤¤- Public d As Object
- Public d2 As Object
½Æ»s¥N½X |
|