Hello.
I'm trying to filter a database that looks like this:
I'm trying to filter Column T so all rows are deleted besides the ones that start with MFS or #N/A(take a look at rows 18 and 19 in column T)
If there are no results, I want to clear filters, run a macro that enters "No violations" at the end of the dataset(look at code), and then save and close workbook. Or else do nothing.
Here is the code I have and I've tested and tried different alternatives and still getting multiple errors. I'm not sure if something is out of order or what.
What can I do to fix this?
Sub Filter()
' FilterMacro
' Keyboard Shortcut: Ctrl+p
With ActiveSheet
.Range("A1:T1").AutoFilter Field: = 20, "<>MFS*", xlAnd, "<>#N/A"
.AutoFilter.Range.Offset(1).EntireRow.Delete
If .AutoFilter.Range.Columns(1).SpecialCells(xlVisible).Count = 1 Then
.AutoFilterMode = False:
Application.Run "PERSONAL.XLSB!FirmSignoff"
'ActiveWorkbook.Close SaveChanges:=True --> closes and signs even if there are results
End If
End With
End Sub
I'm trying to filter a database that looks like this:
I'm trying to filter Column T so all rows are deleted besides the ones that start with MFS or #N/A(take a look at rows 18 and 19 in column T)
If there are no results, I want to clear filters, run a macro that enters "No violations" at the end of the dataset(look at code), and then save and close workbook. Or else do nothing.
Here is the code I have and I've tested and tried different alternatives and still getting multiple errors. I'm not sure if something is out of order or what.
What can I do to fix this?
Sub Filter()
' FilterMacro
' Keyboard Shortcut: Ctrl+p
With ActiveSheet
.Range("A1:T1").AutoFilter Field: = 20, "<>MFS*", xlAnd, "<>#N/A"
.AutoFilter.Range.Offset(1).EntireRow.Delete
If .AutoFilter.Range.Columns(1).SpecialCells(xlVisible).Count = 1 Then
.AutoFilterMode = False:
Application.Run "PERSONAL.XLSB!FirmSignoff"
'ActiveWorkbook.Close SaveChanges:=True --> closes and signs even if there are results
End If
End With
End Sub