- Sub lqxs()
- Dim Arr, i&, x$, y$, Brr, j&, jj&, aa
- Dim d, k, t, kk, tt, s$, ss$, q$, qq$
- Set d = CreateObject("Scripting.Dictionary")
- Sheet2.Activate
- Brr = Sheet2.UsedRange
- Arr = Sheet1.[a1].CurrentRegion
- For i = 1 To UBound(Arr)
- x = Left(Arr(i, 1), 2): y = Left(Arr(i, 3), 2)
- If d.exists(x) = False Then Set d(x) = CreateObject("Scripting.Dictionary")
- d(x)(y) = d(x)(y) & i & ","
- Next
- k = d.keys
- For i = 1 To UBound(Brr)
- s = Left(Brr(i, 1), 2)
- If d.exists(s) Then
- q = Left(Brr(i, 3), 2)
- kk = d(s).keys: tt = d(s).items
- For j = 0 To UBound(kk)
- If InStr(kk(j), q) Then
- t = tt(j): ss = "": qq = ""
- t = Left(t, Len(t) - 1)
- If InStr(t, ",") Then
- aa = Split(t, ",")
- Cells(i, 5) = Arr(aa(0), 1)
- For jj = 0 To UBound(aa)
- ss = ss & Arr(aa(jj), 2) & " ": qq = qq & Arr(aa(jj), 3) & " "
- Next
- Cells(i, 6) = ss: Cells(i, 7) = qq
- Else
- Cells(i, 5) = Arr(t, 1): Cells(i, 6) = Arr(t, 2): Cells(i, 7) = Arr(t, 3)
- End If
- GoTo 100
- End If
- Next
- Cells(i, 3).Interior.ColorIndex = 3
- End If
- 100:
- Next
- End Sub
复制代码 |