How can I use VBA to ignore green triangle error in range without looping cell by cell?

前端 未结 5 683
后悔当初
后悔当初 2021-01-02 20:30

I have some large data sets that I am automating and distributing. I want to eliminate the little green triangles that warn the user about numbers stored as text. I have use

5条回答
  •  盖世英雄少女心
    2021-01-02 20:59

    There appears to be an error in the code shared by the original poster. In order to get this to work I have add to add in the .Item of the error:

    Dim rngCell As Range, bError As Byte
    For Each rngCell In Selection.Cells
    
        For bError = 1 To 4
    
            With rngCell
                If .Errors.Item(bError).value Then
                    .Errors.Item(bError).Ignore = True
                End If
            End With
        Next bError
    Next rngCell
    

提交回复
热议问题