Excel教程:让执行VBA过程时屏幕不出现闪烁现象

本文为《别怕,Excel VBA其实特别简单(第3版)》随书问题参考答案

要解决本列的问题,可以在过程中设置Application对象的ScreenUpdating 属性为alse,将过程改写为:

Sub 将工作表另存为工作簿()

Application.ScreenUpdating = False

Dim Sht As Worksheet

For Each Sht In Worksheets

Sht.Copy

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & Sht.Name & ".xlsx"

ActiveWorkbook.Close

Next Sht

Application.ScreenUpdating = True

End Sub

AI助手