Excel VisualBasic Script

Sub TurnOffAutoFilter()
    Worksheets("Sheet1").Select
    On Error Resume Next
    x = ActiveSheet.autoFilter.range.Areas.count
    If Err.Number = 0 Then
        ActiveSheet.range("A1").autoFilter
    End If
    On Error Resume Next
End Sub