|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
总表拆分- Sub ykcbf() '//2024.11.14
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim t: t = Timer
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- arr = sh.UsedRange
- For i = 2 To UBound(arr)
- If arr(i, 1) <> Empty Then
- sh.Copy
- Set wb = ActiveWorkbook
- With wb.Sheets(1)
- .AutoFilterMode = False
- .DrawingObjects.Delete
- .Rows("1:1").AutoFilter
- .Cells(1, 1).AutoFilter Field:=1, Criteria1:="<>" & arr(i, 1)
- .Cells(2, 1).Resize(UBound(arr) - 1).EntireRow.Delete
- .AutoFilterMode = False
- End With
- wb.SaveAs p & arr(i, 1)
- wb.Close
- End If
- Next
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- MsgBox "拆分完毕,共用时: " & Format(Timer - t, "0.000秒"), , "提示"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|