Private Sub ListBox1_Change() If Reload Then Exit Sub For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) = True Then t = t & ";" & Trim(ListBox1.List(i)) Next ActiveCell = Mid(t, 2) End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) With ListBox1 If ActiveCell.EntireRow.Range("a1") <> "" And ActiveCell.Column = 5 And ActiveCell.Row > 1 Then t = ActiveCell.Value Reload = True For i = 0 To .ListCount - 1 If InStr(t, .List(i)) Then .Selected(i) = True Else .Selected(i) = False End If Next Reload = False .MultiSelect = fmMultiSelectMulti .ListStyle = fmListStyleOption .ListFillRange = "sheet2!a2:a" & Sheet2.Cells(1, 1).End(xlDown).Row .Top = ActiveCell.Offset(0, 1).Top .Left = ActiveCell.Offset(0, 1).Left .Width = ActiveCell.Width .Height = ActiveCell.Height * 6 .Visible = True Else .Visible = False End If End With End Sub |
|