显示“存储为文本的号码”错误 [英] Show "Number stored as Text" error

查看:127
本文介绍了显示“存储为文本的号码”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是高级过滤器,其中包括0和1。只有在数据表中,过滤器才能正常工作,显示1和0的单元格显示错误消息存储为文本的数字。为此,我必须用双击手动打开单元格,然后按Enter键。然后出现错误消息,并且过滤器工作。如果我不这样做,则过滤器不起作用。

I'm using an Advanced Filter, among others, with 0 and 1's. The filter works correctly only if in the Data sheet the cells with 1 and 0 have the error message "Number stored as text" displayed. For that I have to manually open the cell with double click and press Enter. Then the error message appears and the filter works. If I don't do that, the filter doesn't work.

或者,我可以使用1或0单击单元格,然后按F2显示错误消息。

Alternatively I can click on the cell with 1 or 0 and press F2 to display the error message.

有没有办法与VBA,我可以自动做到这一点?

Is there a way with VBA that I can automatically do that?

非常感谢您的帮助! / p>

Many thanks for your help!

推荐答案

你会发现埋在细胞范围属性的深处,特别是在Errors集合中。只需找到出现错误的单元格,然后将忽略属性设置为 True

You'll find that buried deep in the Range properties for the cells, specifically in the Errors collection. Just find the cells where that error is present, then set the Ignore property to True:

Public Sub IgnoreNumsAsText()
    Dim current As Range
    For Each current In ActiveSheet.UsedRange.Cells
        With current
            If .Errors.Item(xlNumberAsText).Value = True Then
                .Errors.Item(xlNumberAsText).Ignore = True
            End If
        End With
    Next current
End Sub

这篇关于显示“存储为文本的号码”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆