小编Mat*_*tth的帖子

Excel ScreenUpdating错误和仍然闪烁的屏幕

我有以下简单的代码来关闭一系列打开的工作簿。我刚刚切换到Excel 2013,在此新版本中,对于未隐藏的每个工作簿,我的屏幕在Excel中始终闪烁一个白色窗口。

如何使烦人的屏幕闪烁关闭?

Sub CloseFiles()
    On Error Resume Next

    Application.ScreenUpdating = False
    Application.StatusBar = "Please wait while files are closed."
    Application.DisplayAlerts = False

    Dim rCell As Range
    For Each rCell In Range("Files")
      Application.StatusBar = "Closing file " & rCell.Value
      If rCell.Value <> "" Then
         Windows(rCell.Value).Visible = True
         Workbooks(rCell.Value).Close SaveChanges:=True
      End If
    Next rCell

    Application.WindowState = xlMaximized
    Windows("Filename.xlsm").Activate

    Application.DisplayAlerts = True
    Application.StatusBar = False
    Application.ScreenUpdating = True

End Sub
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1