- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# man65boy
ListBox1 §ó´«¬° ComboBox1
ListBox2 §ó´«¬° ComboBox2- Dim xlSh As Worksheet
- Private Sub UserForm_Initialize()
- Set xlSh = Sheets("Á`ªí")
- TextBox1_Change '
- End Sub
- Private Sub CommandButton1_Click()
- Dim Rng As Range, xi As Integer
- If ComboBox1.ListIndex > -1 And ComboBox2.ListIndex > -1 Then
- With xlSh
- xi = 2
- Do While .Cells(xi, "C") <> ""
- If .Cells(xi, "B").Text = ComboBox2 And .Cells(xi, "C") = ComboBox1 Then
- If Rng Is Nothing Then
- Set Rng = .Range(.Cells(xi, "d"), .Cells(xi, "i"))
- Else
- Set Rng = Union(Rng, .Range(.Cells(xi, "d"), .Cells(xi, "i")))
- End If
- End If
- xi = xi + 1
- Loop
- Rng.Copy
- Sheets("³ø»ù³æ¦C¦L").Cells(Rows.Count, "b").End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
- End With
- Else
- MsgBox "«È¤á¦WºÙ ©Î ¤é´Á ??? "
- End If
- End Sub
- Private Sub CommandButton2_Click()
- Unload UserForm1
- End Sub
- Private Sub TextBox1_Change()
- Dim xi As Integer, xlString As String
- With xlSh
- xi = 2
- Do While .Cells(xi, "C") <> ""
- If .Cells(xi, "C") Like "*" & TextBox1 & "*" Then
- If InStr(xlString, "," & .Cells(xi, "C") & ",") = 0 Then
- xlString = xlString & "," & .Cells(xi, "C") & ","
- End If
- End If
- xi = xi + 1
- Loop
- End With
- If xlString = "" Then 'TextBox1ªº¤º®e§ä¤£¨ì
- ComboBox1.Clear
- ComboBox2.Clear
- Exit Sub
- End If
- With ComboBox1
- .List = Split(Mid(xlString, 2, Len(xlString) - 2), ",,")
- .Value = .List(0)
- End With
- End Sub
- Private Sub ComboBox1_Change()
- Dim xi As Integer, xlString As String
- If ComboBox1.ListIndex > -1 Then
- '±±¨î¶µ.ListIndex = -1 ±±¨î¶µªº ȩοﶵ ¤£¦bList¤º
- With xlSh
- xi = 2
- Do While .Cells(xi, "C") <> ""
- If .Cells(xi, "C") = ComboBox1 Then
- If InStr(xlString, "," & .Cells(xi, "B") & ",") = 0 Then
- xlString = xlString & "," & .Cells(xi, "B") & ","
- End If
- End If
- xi = xi + 1
- Loop
- End With
- With ComboBox2
- .List = Split(Mid(xlString, 2, Len(xlString) - 2), ",,")
- .Value = .List(0)
- End With
- ElseIf ComboBox1.ListIndex = -1 Then
- ComboBox2.Clear
- End If
- End Sub
½Æ»s¥N½X |
|