Private Sub ListBox1_Change()If Reload Then Exit Sub '见下方说明For i = 0 To ListBox1.ListCount - 1If ListBox1.Selected(i) = True Then t = t & "," & ListBox1.List(i)NextActiveCell = Mid(t, 2)End SubPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)With ListBox1If ActiveCell.Column = 11 And ActiveCell.Row > 8 Thent = ActiveCell.ValueReload = True '如果是根据单元格的值修改列表框,则暂时屏蔽listbox的change事件。For i = 0 To .ListCount - 1 '根据活动单元格内容修改列表框中被选中的内容If InStr(t, .List(i)) Then.Selected(i) = TrueElse.Selected(i) = FalseEnd IfNextReload = False.Top = ActiveCell.Top + ActiveCell.Height '以下语句根据活动单元格位置显示列表框.Left = ActiveCell.Left.Width = ActiveCell.Width.Visible = TrueElse.Visible = FalseEnd IfEnd WithEnd Sub
不行啊。本人不懂VBA