跳到主要内容

如何在Excel中隐藏不一致的公式错误?

如下面的屏幕截图所示,当公式与位于其附近的其他单元格的公式模式不匹配时,该单元格中将出现一个绿色错误指示符。 实际上,您可以隐藏此不一致的公式错误。 本文将向您展示实现它的方法。

隐藏单个不一致的公式错误并忽略错误
使用VBA代码隐藏选择中所有不一致的公式错误


隐藏单个不一致的公式错误并忽略错误

您可以每次都隐藏一个不一致的公式错误,而忽略Excel中的错误。 请执行以下操作。

1.选择包含要隐藏的错误指示符的单元格,然后单击显示按钮 在牢房旁边。 看截图:

2。 选择 忽略错误 从下拉列表中如下图所示。

然后错误指示器将立即被隐藏。


使用VBA代码隐藏选择中所有不一致的公式错误

下面的VBA方法可以帮助您隐藏工作表中所选内容中所有不一致的公式错误。 请执行以下操作。

1.在工作表中,您需要隐藏所有不一致的公式错误,然后按 其他 + F11 同时打开 Microsoft Visual Basic应用程序 窗口。

2.在 Microsoft Visual Basic应用程序 窗口,请点击 插页 > 模块,然后将VBA代码复制并粘贴到“代码”窗口中。

VBA代码:隐藏工作表中所有不一致的公式错误

Sub HideInconsistentFormulaError()
    Dim xRg As Range, xCell As Range
    Dim xError As Byte
    On Error Resume Next
    Set xRg = Application.InputBox("Please select the range:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    For Each xCell In xRg
        If xCell.Errors(xlInconsistentFormula).Value Then
            xCell.Errors(xlInconsistentFormula).Ignore = True
        End If
    Next
End Sub

3。 按 F5 键来运行代码。 在弹出 Kutools for Excel 对话框,请选择要隐藏所有不一致的公式错误的范围,然后单击 OK 按钮。 看截图:

然后,所有不一致的公式错误都会立即从所选范围中隐藏。 看截图:

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello Crystal,

thank you very much for the code, its working now :)


Greets

speedy
This comment was minimized by the moderator on the site
Hello Crystal,

thank you for your testing time.

Do you use a basic old school (user formatted table) only or is it a table with a excel design and filter function in column head ?
Like shown here:
https://support.microsoft.com/de-de/office/%C3%BCbersicht-zu-excel-tabellen-7ab0bb7d-3a9e-4b56-a3c9-6c94334e492c

Latest is what I am using.

I can´t share my "programm" - its a financial tool for personal use.
The cells are with this content:
=HYPERLINK("https://www.domain.de/abc.html";"www")

Because each row has a another link, I´m getting the inconsistent errors.
I can hide it manually, but not with VBA.

I don´t know if your vba just works for a few seconds and then the errors appear again.
This comment was minimized by the moderator on the site
Hi speedy,
Many thanks for your feedback. The original code did not take into account the Table format data. The code has been updated as follows, please give it a try.

Sub HideInconsistentFormulaError()
'Updated by Extendoffice 20220902
    Dim xRg As Range, xCell As Range
    Dim xError As Byte
    On Error Resume Next
   Set xRg = Application.InputBox("Please select the range:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    For Each xCell In xRg
        If xCell.Errors(xlEmptyCellReferences).Value Then
            xCell.Errors(xlEmptyCellReferences).Ignore = True
        ElseIf xCell.Errors(xlEvaluateToError).Value Then
            xCell.Errors(xlEvaluateToError).Ignore = True
        ElseIf xCell.Errors(xlInconsistentFormula).Value Then
            xCell.Errors(xlInconsistentFormula).Ignore = True
        ElseIf xCell.Errors(xlInconsistentListFormula).Value Then
            xCell.Errors(xlInconsistentListFormula).Ignore = True
        ElseIf xCell.Errors(xlListDataValidation).Value Then
           xCell.Errors(xlListDataValidation).Ignore = True
        ElseIf xCell.Errors(xlNumberAsText).Value Then
            xCell.Errors(xlNumberAsText).Ignore = True
        ElseIf xCell.Errors(xlOmittedCells).Value Then
            xCell.Errors(xlOmittedCells).Ignore = True
        ElseIf xCell.Errors(xlTextDate).Value Then
            xCell.Errors(xlTextDate).Ignore = True
        ElseIf xCell.Errors(xlUnlockedFormulaCells).Value Then
            xCell.Errors(xlUnlockedFormulaCells).Ignore = True
        End If
    Next
End Sub
This comment was minimized by the moderator on the site
Hello Crystal,

The newest Excel 365 Version 2207 (Build 15427.20210)
This comment was minimized by the moderator on the site
Hi speedy,
I have tested the code in the same version (2207 (Build 15425.20210)) and it stil works.
Can you upload a sample file of your data here?
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/365_version.png
This comment was minimized by the moderator on the site
Hello,

thank you for sharing your solution, but its not working in newest Excel 365
No VBA-Errors, but Excel still shows the inconsistent errors
This comment was minimized by the moderator on the site
Hi speedy,
Can you tell me the version of your Excel 365 you have?
I have tested the code in Excel 365 and it works well. so the problem cannot be reproduced.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations