Search code examples
excelvbaexcel-tableslistobject

VBA Auto Filter: No Cells were found


Please help.

I want to filter my table by field 13 for values that are <0.5 and delete those visible rows, but I get the error code that no cells were found, even though there clearly are values that meet that criteria.

Dim lo As ListObject
Set lo = Worksheets("Aluminum Futures").ListObjects("PF")
    
    lo.Range.AutoFilter Field:=13, Criteria1:="<0.5"

    Application.DisplayAlerts = False
       lo.DataBodyRange.SpecialCells(xlCellTypeVisible).Delete
    Application.DisplayAlerts = True

    lo.AutoFilter.ShowAllData

What am I doing wrong?


Solution

  • I created a new column where the cell values were that of the original multiplied by 1. This gave my the numerical filters that I needed.