Show “Number stored as Text” error

前端 未结 1 1690
感情败类
感情败类 2021-01-24 19:08

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

1条回答
  •  心在旅途
    2021-01-24 19:20

    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
    

    0 讨论(0)
提交回复
热议问题