percy4
04-21-2009, 12:34 AM
Hi VBA-lovers,
I’ve got a small problem with an autofilter reset.
Pls see below code. The problem I am having with this code is that it gives me the “runtime error 1004. Showall data method on worksheet class failed” when I press this button without any parameters in the autofilter is set. It works fine when a parameter is set.
It’s probably very easy but I am a total noob at VBA programming.
What I want is just to clear any possible filter parameters not deleting the autofilter itself.
Please help me =)
Regards
Per
Sub flooring_veiw()
Sheets("History sheet").Select
Columns("A:AA").Select
Selection.EntireColumn.Hidden = False
If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
' rensar ditt gamla val
Sheets("History sheet").Select
Columns("J:U").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.DisplayHorizontalScrollBar = False
Range("A1").Select
ActiveWindow.ScrollColumn = 1
End Sub
I’ve got a small problem with an autofilter reset.
Pls see below code. The problem I am having with this code is that it gives me the “runtime error 1004. Showall data method on worksheet class failed” when I press this button without any parameters in the autofilter is set. It works fine when a parameter is set.
It’s probably very easy but I am a total noob at VBA programming.
What I want is just to clear any possible filter parameters not deleting the autofilter itself.
Please help me =)
Regards
Per
Sub flooring_veiw()
Sheets("History sheet").Select
Columns("A:AA").Select
Selection.EntireColumn.Hidden = False
If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
' rensar ditt gamla val
Sheets("History sheet").Select
Columns("J:U").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.DisplayHorizontalScrollBar = False
Range("A1").Select
ActiveWindow.ScrollColumn = 1
End Sub