I have figured out a solution. Here is the attached code.
const xlUp = -4162
lastRow = ws1.UsedRange.Rows.Count
lastColumn = ws1.UsedRange.Columns.Count
Set rngDataBlock = ws1.Range(ws1.Cells(1,1),ws1.Cells(lastRow,lastColumn))
rngDataBlock.AutoFilter 4,"a",,,False
If ws1.Cells(1,4).Value =...