|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub yy()
- Dim Arr, i&, Myr&, Myc%, Arr2, Arr3, col, x$
- Dim d, k, t, m&, n1&, n2&, j&, zm$
- Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- Sheet3.Activate
- [a6:s500].Clear
- zm = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- Myc = [iv2].End(xlToLeft).Column
- Arr3 = Range("a2").Resize(1, Myc)
- Arr = Sheet1.[a1].CurrentRegion
- Arr2 = Sheet2.[a1].CurrentRegion
- ReDim col(1 To UBound(Arr3, 2))
- For j = 1 To UBound(Arr3, 2)
- col(j) = InStr(zm, UCase(Arr3(1, j)))
- Next
- n1 = 5: n2 = 5
- For i = 2 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- x = Arr(i, 1)
- For j = 1 To UBound(col)
- x = x & "," & Arr(i, col(j))
- Next
- d(x) = i
- End If
- Next
- For i = 2 To UBound(Arr2)
- If Arr2(i, 1) <> "" Then
- x = Arr2(i, 1)
- For j = 1 To UBound(col)
- x = x & "," & Arr2(i, col(j))
- Next
- m = d(x)
- If m = 0 Then
- n2 = n2 + 1
- Cells(n2, 11).Resize(1, UBound(Arr2, 2)) = Application.Index(Arr2, i, 0)
- End If
- End If
- Next
- d.RemoveAll
- For i = 2 To UBound(Arr2)
- If Arr2(i, 1) <> "" Then
- x = Arr2(i, 1)
- For j = 1 To UBound(col)
- x = x & "," & Arr2(i, col(j))
- Next
- d(x) = i
- End If
- Next
- For i = 2 To UBound(Arr)
- If Arr(i, 1) <> "" Then
- x = Arr(i, 1)
- For j = 1 To UBound(col)
- x = x & "," & Arr(i, col(j))
- Next
- m = d(x)
- If m = 0 Then
- n1 = n1 + 1
- Cells(n1, 1).Resize(1, UBound(Arr, 2)) = Application.Index(Arr, i, 0)
- End If
- End If
- Next
- If n1 <> 5 Then [a6].Resize(n1 - 5, 9).Borders.LineStyle = 1
- If n2 <> 5 Then [k6].Resize(n2 - 5, 9).Borders.LineStyle = 1
- Set d = Nothing
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|