- Private Sub 单击提取_Click()
- Dim Ar, i&, d, k, t, ks, js, j&, aa, x$, d1
- [a7:b5000].ClearContents
- Ar = Sheet2.Range("a3").CurrentRegion
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- ks = [e3].Value: js = [e4].Value: n = 6
- For i = 8 To UBound(Ar)
- x = Ar(i, 3) & "," & Ar(i, 13)
- d(x) = d(x) & i & ","
- Next
- k = d.keys
- x = [a3].Value & "," & [c3].Value
- If d.exists(x) Then
- t = d(x)
- t = Left(t, Len(t) - 1)
- If InStr(t, ",") Then
- aa = Split(t, ",")
- For j = 0 To UBound(aa)
- If Ar(aa(j), 8) >= ks And Ar(aa(j), 8) <= js Then
- For y = 18 To UBound(Ar, 2) Step 12
- If Ar(aa(j), y) <> "" Then
- If Not d1.exists(Ar(aa(j), y)) Then
- n = n + 1
- d1(Ar(aa(j), y)) = ""
- Cells(n, 1) = Ar(aa(j), y)
- Cells(n, 2) = Ar(aa(j), y + 10)
- End If
- Else
- Exit For
- End If
- Next
- End If
- Next
- Else
- If Ar(t, 8) >= ks And Ar(t, 8) <= js Then
- For y = 18 To UBound(Ar, 2) Step 12
- If Ar(t, y) <> "" Then
- If Not d1.exists(Ar(t, 18)) Then
- n = n + 1
- d1(Ar(t, 18)) = ""
- Cells(n, 1) = Ar(t, 18)
- Cells(n, 2) = Ar(t, 28)
- Else
- Exit For
- End If
- End If
- Next
- End If
- End If
- [d6] = n - 6
- End If
- End Sub
复制代码 |