|
Option Explicit
Sub TEST()
Dim ar(1 To 2), i&, j&, r&, strFileName$
Application.ScreenUpdating = False
For i = 1 To UBound(ar)
ar(i) = Sheets(i).[A1].CurrentRegion
r = 1
Next i
For i = 2 To UBound(ar(1))
For j = 2 To UBound(ar(2))
If ar(2)(j, 1) = ar(1)(i, 1) Then
r = r + 1
ar(1)(r, 1) = ar(2)(j, 1)
End If
Next j
Next i
With Workbooks.Add
strFileName = ThisWorkbook.Path & "\" & "另存"
With .Sheets(1).[A1].Resize(r)
.Value = ar(1)
End With
.SaveAs strFileName
.Close
End With
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|