|
Sub 按考点拆分()
Dim arr
Dim d
Set d = CreateObject("scripting.dictionary")
arr = Sheets(1).UsedRange
Application.ScreenUpdating = False
Sheets(1).Select
For j = 2 To UBound(arr)
If Len(arr(j, 10)) > 0 Then
If d.exists(arr(j, 10)) Then
Set d(arr(j, 10)) = Union(d(arr(j, 10)), Cells(j, 1))
Else
Set d(arr(j, 10)) = Union([a1], Cells(j, 1))
End If
End If
Next j
Sheets(1).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
.Close False
End With
MsgBox "ok"
Application.ScreenUpdating = True
End Sub
|
|