Excel VisualBasic Script

Sub TurnOnAutoFilter()
    ' Turn on AutoFilters
    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