|
Sub test()
Set d = CreateObject("scripting.dictionary")
Application.ScreenUpdating = False
arr = [a1].CurrentRegion
For j = 2 To UBound(arr)
If d.exists(arr(j, 4)) Then
Set d(arr(j, 4)) = Union(d(arr(j, 4)), Cells(j, 1))
Else
Set d(arr(j, 4)) = Union(Cells(j, 1), Cells(1, 1))
End If
Next j
ActiveSheet.Copy
With ActiveWorkbook
For Each k In d.keys
.Sheets(1).UsedRange.Clear
d(k).EntireRow.Copy .Sheets(1).[a1]
.SaveAs ThisWorkbook.Path & "\" & k & ".xlsx"
Next k
.Close
End With
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|