【问题标题】:Turn off Excel Background Error Checking on opening the workbook打开工作簿时关闭 Excel 后台错误检查
【发布时间】:2016-05-26 22:58:01
【问题描述】:

我有一个 Excel 工作簿,里面有很多绿色的“错误检查”三角形。

有什么方法可以在我打开工作簿时关闭 Excel VBA。

【问题讨论】:

  • 2 天前,我正在查看我的一份现有报告,发现其中有很多这些三角形。我只是通过重构公式来摆脱它们。
  • 如果您选择所有值,请单击三角形并选择“忽略此错误”,它们都会消失。 -或者-您可以修复错误,即。更改值,使其不会那样做。

标签: vba excel


【解决方案1】:

我想这就是你要找的东西:

    Application.ErrorCheckingOptions.BackgroundChecking = False

【讨论】:

  • 为我工作。我把它放在Private Sub Workbook_Open() 里面ThisWorkbook 宏页面里面。
【解决方案2】:

我找到了我想要的答案:

Sub Auto_Open()
    Application.ErrorCheckingOptions.BackgroundChecking = False 
End Sub

【讨论】:

    【解决方案3】:

    我通常将我的工作簿选项卡拆分为数据、计算和演示。因此,我不喜欢“演示”选项卡中表格的绿色错误检查三角形。一种方法是保护工作表......绿色检查消失了! (并且仅适用于该选项卡)

    如果您仍然希望受保护的选项卡可以访问,那么只需解锁所有单元格并在保护之前选择适当的保护选项。

    我会远离使用宏,因为这可能会影响用户在各种工作簿和选项卡中的设置。

    【讨论】:

      【解决方案4】:

      只需使用这个:

      With Application.ErrorCheckingOptions
          .BackgroundChecking = False
          .EvaluateToError = False
          .TextDate = False
          .NumberAsText = False
          .InconsistentFormula = False
          .OmittedCells = False
          .UnlockedFormulaCells = False
          .ListDataValidation = False
      End With
      

      如果您使用上面的代码,它将永远关闭这个未来,并且适用于所有 excel 文档。

      但如果您只想为您的 excel 文档(不是全部)执行此操作:

          '''''''''''''''' IN A MODULE '''''''''''''''''''
          Public AE_BackgroundChecking As Boolean
          Public AE_EvaluateToError As Boolean
          Public AE_TextDate As Boolean
          Public AE_NumberAsText As Boolean
          Public AE_InconsistentFormula As Boolean
          Public AE_OmittedCells As Boolean
          Public AE_UnlockedFormulaCells As Boolean
          Public AE_ListDataValidation As Boolean
          Public AE_EmptyCellReferences As Boolean
          ''''''''''''''''''''''''''''''''''''''''''''''''
      
          ''''''''''''''''' IN WORKBOOK OPEN EVENT '''''''''''''
      
          AE_BackgroundChecking = Application.ErrorCheckingOptions.BackgroundChecking
          AE_EvaluateToError = Application.ErrorCheckingOptions.EvaluateToError
          AE_TextDate = Application.ErrorCheckingOptions.TextDate
          AE_NumberAsText = Application.ErrorCheckingOptions.NumberAsText
          AE_InconsistentFormula = Application.ErrorCheckingOptions.InconsistentFormula
          AE_OmittedCells = Application.ErrorCheckingOptions.OmittedCells
          AE_UnlockedFormulaCells = Application.ErrorCheckingOptions.UnlockedFormulaCells
          AE_ListDataValidation = Application.ErrorCheckingOptions.ListDataValidation
          AE_EmptyCellReferences = Application.ErrorCheckingOptions.EmptyCellReferences
      
          With Application.ErrorCheckingOptions
              .BackgroundChecking = False
              .EvaluateToError = False
              .TextDate = False
              .NumberAsText = False
              .InconsistentFormula = False
              .OmittedCells = False
              .UnlockedFormulaCells = False
              .ListDataValidation = False
              .EmptyCellReferences = False
          End With
          ''''''''''''''''''''''''''''''''''''''''''
      
      
      
      ''''''''''''''''' IN WORKBOOK CLOSE EVENT '''''''''''''
      Application.ErrorCheckingOptions.BackgroundChecking = AE_BackgroundChecking
      Application.ErrorCheckingOptions.EvaluateToError = AE_EvaluateToError
      Application.ErrorCheckingOptions.TextDate = AE_TextDate
      Application.ErrorCheckingOptions.NumberAsText = AE_NumberAsText
      Application.ErrorCheckingOptions.InconsistentFormula = AE_InconsistentFormula
      Application.ErrorCheckingOptions.OmittedCells = AE_OmittedCells
      Application.ErrorCheckingOptions.UnlockedFormulaCells = AE_UnlockedFormulaCells
      Application.ErrorCheckingOptions.ListDataValidation = AE_ListDataValidation
      Application.ErrorCheckingOptions.EmptyCellReferences = AE_EmptyCellReferences
      '''''''''''''''''''''''''''''''''''''''''''''''''''''''
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多