excelvbaexcel-tableslistobject

Filter for values that are <0.5 and delete visible rows


I want to filter my table by field 13 for values that are <0.5 and delete those visible rows.

I get the error code that no cells were found. There are values that meet the 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

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.