method showalldata of object _worksheet failed vba

The solution for “method showalldata of object _worksheet failed vba” can be found here. The following code will assist you in solving the problem.

‘this method should not give error “method showalldata of object _worksheet failed”
Sub ClearFiters()
Dim MySheet As Worksheet: Set MySheet = ThisWorkbook.Sheets(“MySheet”)
Dim MyTableName As String: MyTableName = “MyTable”
MySheet.Activate
MySheet.Range(MyTableName).Select
Dim t As ListObject: Set t = MySheet.ListObjects(MyTableName)
t.Sort.SortFields.Clear
If t.AutoFilter.FilterMode Then
MySheet.ShowAllData
End If
End Sub

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts