|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set sh = Sheets("明细栏")
arr = sh.UsedRange
r = 1
For j = 1 To UBound(arr)
If arr(j, 1) = "图纸名称" Then
sh.Copy
ActiveSheet.UsedRange.Clear
sh.Range(sh.Cells(r, 1), sh.Cells(j, UBound(arr, 2))).Copy ActiveSheet.[a1]
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & arr(j, 2) & ".xlsx"
ActiveWorkbook.Close False
r = j + 3
End If
Next j
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
|
|