- Sub qs() '2024\09\19
- Dim arr, i, dic, sht As Worksheet
- Set dic = CreateObject("scripting.dictionary")
- ReDim brr(1 To 50000, 1 To 4): crr = [{"日期","备注","文件名称","列号"}]
- For Each sht In Sheets
- If sht.Name <> "重复信息" Then
- arr = sht.Range("a9").CurrentRegion.Value
- For c = 2 To UBound(arr, 2)
-
- s = arr(2, c)
- If Not dic.exists(s) Then
- dic(s) = Array(arr(1, c), sht.Name, c)
- Else
- m = m + 1
- k = dic(s)
- brr(m, 1) = k(0): brr(m, 2) = s
- brr(m, 3) = k(1): brr(m, 4) = k(2)
- m = m + 1
- brr(m, 1) = arr(1, c): brr(m, 2) = s
- brr(m, 3) = sht.Name: brr(m, 4) = c
- End If
- Next c
- End If
- Next sht
- With Sheet3
- .Cells.Clear
- .Range("a1").Resize(1, 4) = crr
- .Range("a2").Resize(m, 4) = brr
- .ListObjects.Add xlSrcRange, [a1].CurrentRegion, , xlYes
- End With
- End Sub
复制代码 |