|
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Target.Count > 1 Then Me.ListBox1.Visible = False: Exit Sub
- If Target.Column < 10 Or Target.Column > 13 Or Target.Row < 3 Then Me.ListBox1.Visible = False: Exit Sub
- Dim i&, j&, k
- If Target.Column = 10 Then
- Arr = Sheet1.[a2].CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- Target.Resize(1, 4) = ""
- For i = 2 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- r = r + 1
- ReDim Preserve Arr1(1 To r)
- Arr1(r) = i
- d(Arr(i, 1)) = r
- End If
- Next
- k = d.keys
- ElseIf Target.Column = 11 Then
- Arr = Sheet1.[a2].CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- Target.Resize(1, 3) = ""
- For i = 2 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- r = r + 1
- ReDim Preserve Arr1(1 To r)
- Arr1(r) = i
- d(Arr(i, 1)) = r
- End If
- Next
- gs = Target.Offset(0, -1).Value
- Call yy(gs)
- k = d1.keys
- ElseIf Target.Column = 12 Then
- Target.Resize(1, 2) = ""
- gs = Target.Offset(0, -2).Value: r = 0
- Arr = Sheet1.[d2].CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- For i = 2 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- r = r + 1
- ReDim Preserve Arr1(1 To r)
- Arr1(r) = i
- d(Arr(i, 1)) = r
- End If
- Next
- Call yy(gs)
- k = d1.keys
- ElseIf Target.Column = 13 Then
- gs = Target.Offset(0, -1).Value: r = 0
- Arr = Sheet1.[g2].CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- For i = 2 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- r = r + 1
- ReDim Preserve Arr1(1 To r)
- Arr1(r) = i
- If InStr(Arr(i, 1), ",") Then
- aa = Split(Arr(i, 1), ",")
- For j = 0 To UBound(aa)
- b = Left(aa(j), Len(aa(j)) - 1)
- d(b) = r
- Next
- Else
- b = Left(Arr(i, 1), Len(Arr(i, 1)) - 1)
- d(b) = r
- End If
- End If
- Next
- Call yy1(gs)
- k = d1.keys
- Else
- Exit Sub
- End If
- With Me.ListBox1
- .Clear
- .Visible = True
- .List = k
- .Top = Target.Offset(1, 0).Top
- .Left = Target.Offset(0, 1).Left
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|