| ©«¤l5923 ¥DÃD13 ºëµØ1 ¿n¤À5986 ÂI¦W0  §@·~¨t²Îwin10 ³nÅ骩¥»Office 2010 ¾\ŪÅv150 ©Ê§O¨k ¨Ó¦Û¥xÆW°ò¶© µù¥U®É¶¡2010-5-1 ³Ì«áµn¿ý2022-1-23 
         
 | 
                
| ¦^´_ 1# yliu ¸Õ¸Õ¬Ý
 ½Æ»s¥N½XPrivate Const Sh = "DATA" 'Const ³¯z¦¡ «Å§i±`¼Æ , ¨äȦp¦r±©Ò¥Ü ("DATA")
Dim D As Object
Private Sub UserForm_Initialize()
    Dim i As Integer
    Set D = CreateObject("Scripting.Dictionary")
    With ListBox1
        .ColumnCount = 4                                      'øó¦ì¼Æ
        .ColumnWidths = "120 pt;80 pt;80 pt;80 pt"            '³]©wÄæ¼e
    End With
    With Sheets(Sh)
        i = 2
        Do While .Cells(i, "A") <> ""
            D(.Cells(i, "A").Value) = ""
            i = i + 1
        Loop
    End With
    With ComboBox1
        .List = D.KEYs
        .Value = .List(0)
    End With
End Sub
Private Sub ComboBox1_Change()
    Dim i As Integer, R As Integer
    ListBox1.Clear
    TextBox1 = ""
    TextBox2 = ""
    TextBox3 = ""
    Set D = CreateObject("Scripting.Dictionary")
    With Sheets(Sh)
        i = 2
        Do While .Cells(i, "A") <> ""
            If .Cells(i, "A") = ComboBox1 Then
                With ListBox1
                    .AddItem
                    R = .ListCount
                    .List(R - 1, 0) = Sheets(Sh).Cells(i, "B")  '³æ¸¹+§Ç¸¹
                    .List(R - 1, 1) = Sheets(Sh).Cells(i, "C")  '«~¦W
                    .List(R - 1, 2) = Sheets(Sh).Cells(i, "D")  '³W®æ
                    .List(R - 1, 3) = Sheets(Sh).Cells(i, "E")  'ª÷ÃB
                End With
            End If
            i = i + 1
        Loop
    End With
End Sub
Private Sub ListBox1_Change() '±N¿ï¨úListBoxªºÈ©ñ¨ìTextBox
    Dim Ar(1 To 3) As String, i As Integer
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(i) = True Then
            Ar(1) = IIf(Ar(1) = "", "", Ar(1) & vbTab) & ListBox1.List(i, 1)    '«~¦W
            Ar(2) = IIf(Ar(2) = "", "", Ar(2) & vbTab) & ListBox1.List(i, 2)    '³W®æ
            Ar(3) = Val(Ar(3)) + Val(ListBox1.List(i, 3))                       'ª÷ÃB
        End If
    Next
    TextBox1 = Ar(1)
    TextBox2 = Ar(2)
    TextBox3 = Ar(3)
End Sub
 | 
 |