|
- Private Sub ListBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- Dim i&, xm$
- If KeyCode = 13 Then
- For i = 0 To ListBox1.ListCount - 1
- If ListBox1.Selected(i) Then
- xm = xm & ListBox1.List(i) & ","
- End If
- Next
- If xm <> "" Then ActiveCell = Left(xm, Len(xm) - 1): ListBox1.Visible = False
- End If
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Target.Count > 1 Then ListBox1.Visible = False: Exit Sub
- If Target.Column <> 26 Or Target.Row < 4 Then ListBox1.Visible = False: Exit Sub
- Dim Arr, i&
- Arr = Sheet3.[a1].CurrentRegion
- With ListBox1
- .Visible = True
- .Clear
- For i = 1 To UBound(Arr)
- .AddItem Arr(i, 1)
- Next
- .Top = Target.Top
- .Left = Target.Left + Target.Width
- .ListStyle = 1
- .MultiSelect = 1
- End With
- End Sub
复制代码 |
|