|
代码如下:
- Sub ykcbf() '//2023.4.12
- Dim arr, brr(1 To 10000, 1 To 4), d
- Set d = CreateObject("scripting.dictionary")
- Set Sh = Sheets("合并")
- For Each sht In Sheets
- If sht.Name <> Sh.Name Then
- arr = sht.UsedRange
- For i = 2 To UBound(arr)
- s = arr(i, 1) & "|" & arr(i, 2) & "|" & sht.Name
- If s <> Empty Then
- d(s) = arr(i, 3)
- End If
- Next
- End If
- Next
- For Each k In d.keys
- m = m + 1
- brr(m, 1) = Split(k, "|")(0)
- brr(m, 2) = Split(k, "|")(1)
- brr(m, 3) = d(k)
- brr(m, 4) = Split(k, "|")(2)
- Next
- With Sh
- .UsedRange.Offset(1).Clear
- .[a2].Resize(m, 4) = brr
- .[a2].Resize(m, 4).Borders.LineStyle = 1
- End With
- End Sub
复制代码
|
|