|
是的。只能通过vba。代码在工作表里。- Sub 生成()
- Call 删除
- arr = [a1].CurrentRegion
- Set d = CreateObject("scripting.dictionary")
- For i = 2 To UBound(arr)
- x = Replace(Replace(arr(i, 1), "/", ""), "*", "×")
- If Not d.exists(x) Then
- Set d(x) = Union([a1:g1], Cells(i, 1).Resize(1, 7))
- Else
- Set d(x) = Union(d(x), Cells(i, 1).Resize(1, 7))
- End If
- Next
- For Each x In d.keys
- Worksheets.Add after:=Sheets(Sheets.Count)
- With ActiveSheet
- .Name = x
- d(x).Copy .[a1]
- .Columns.AutoFit
- End With
- Next
- Sheets(1).Activate
- End Sub
- Sub 删除()
- Dim sh As Worksheet
- Application.DisplayAlerts = False
- For Each sh In Worksheets
- If sh.Index > 1 Then sh.Delete
- Next
- Application.DisplayAlerts = True
-
- End Sub
复制代码 |
|