|
Option Explicit
Sub TEST1()
Dim ar, br, i&, j&, r&, wks As Worksheet, dic As Object, strJoin$
Set dic = CreateObject("Scripting.Dictionary")
With CreateObject("VBScript.RegExp")
.Pattern = "工资|物贴"
For Each wks In Worksheets
If .test(wks.Name) Then
With wks
r = .Cells(.Rows.Count, "A").End(xlUp).Row
br = .Range("A1:C" & r).Value
For i = 2 To UBound(br)
strJoin = ""
For j = 1 To UBound(br, 2)
strJoin = strJoin & "|" & br(i, j)
Next j
dic(strJoin) = Empty
Next i
End With
End If
Next
End With
ReDim ar(1 To dic.Count, 1 To 3) As String
For i = 0 To dic.Count - 1
br = Split(dic.keys()(i), "|")
For j = 1 To UBound(br)
ar(i + 1, j) = br(j)
Next j
Next i
With Worksheets("汇总")
.[C1].CurrentRegion.Offset(1).Clear
.[C2].Resize(UBound(ar), UBound(ar, 2)) = ar
.Activate
End With
Beep
End Sub
|
评分
-
1
查看全部评分
-
|