|
楼主 |
发表于 2020-11-27 21:06
|
显示全部楼层
本帖最后由 河南防腐小屈 于 2020-11-28 07:23 编辑
Sub 批量布局视图()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim ar()
w = MsgBox("在运行生成目录之前,务必要先生成文件,是否继续?", vbYesNo)
If w = vbNo Then Exit Sub
t = Timer
f = Dir(ThisWorkbook.Path & "\拆分文件\*.xls*")
Do While f <> ""
Set wb = Workbooks.Open(ThisWorkbook.Path & "\拆分文件\" & f, 0)
n = 0: hj = 0
ReDim ar(1 To wb.Worksheets.Count - 3, 1 To 4)
For Each sh In wb.Worksheets
ActiveWindow.View = xlPageLayoutView
Next sh
wb.Close True
f = Dir
Loop
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "耗时:" & Format(Timer - t, "0.00") & "秒"
End Sub
麻烦大神帮看一下代码为啥不起作用?只改了最后一个sheet表
|
|