|
- Dim arr
- Private Sub ListBox1_Change()
- If ListBox1.ListIndex = -1 Then Exit Sub
- Dim i&, s$, he
- With ListBox1
- For i = 0 To .ListCount - 1
- If .Selected(i) Then
- s = s & "、" & .List(i)
- he = he + arr(i + 1, 2)
- End If
- Next
- ActiveCell.Value = Mid(s, 2)
- ActiveCell.Offset(0, 1).Value = he
- End With
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal T As Range)
- If T.Count > 1 Or T.Row < 2 Or T.Column <> 2 Then
- ListBox1.Visible = False
- Range("b:b").Interior.ColorIndex = 0
- Exit Sub
- End If
-
- arr = Sheet2.Range("a2:b" & Sheet2.[a65536].End(3).Row)
- Range("b:b").Interior.ColorIndex = 0
- T.Interior.ColorIndex = 6
- With ListBox1
- .Clear
- .MultiSelect = 1
- .ListStyle = 1
- .List = Application.Index(arr, , 1)
- .Top = T.Top
- .Left = T.Offset(, 1).Left
- .Height = T.Height * 6
- .Width = T.Width + 20
- .Visible = True
- End With
- End Sub
复制代码 |
|