Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

excel autofilter where criteria is the cell value must not contain a letter or a number

i have a range A to N, initially i filter it by H(field 8) then I want to filter it again by column N(field 14) with the criteria that the rows in column N must not contain a letter or a number, how would be the way to do that?

rng.AutoFilter Field:=8, Criteria1:="Value" 'Filter by Column H
rng.AutoFilter Field:=14, Criteria1:=       'Filter by Column N

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Have to create another column with this formula and filter this column:

Function hasDigitsOrNumbers(s As String) As String
    Dim ch As String, ln As Long
    Dim i As Long
    
    ln = Len(s)

    For i = 1 To ln
        ch = Mid(s, i, 1)
        If (ch >= "0" And ch <= "9") Or (ch >= "a" And ch <= "z") Or (ch >= "A" And ch <= "Z") Then
            hasDigitsOrNumbers = True
            Exit Function
        End If
    Next
    hasDigitsOrNumbers = False
End Function

=hasDigitsOrNumbers(N1) and returns true if the N1 has digits or letters, otherwise returns FALSE.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading