Very simple VBA question

bienvenu

New Member
Joined
Aug 12, 2014
Messages
35
Hello

I don't do VBA, but I do record macros and I have done this one which clears the filters on a sheet and then navigates to another sheet.

It works fine, unless there are no filters to clear on the sheet, in which case I get an error

Sub resetfilterstest()
'
' resetfilterstest Macro
'


'
ActiveSheet.ShowAllData
Sheets("FrontEnd").Select
End Sub
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

NeonRedSharpie

Well-known Member
Joined
Jul 14, 2014
Messages
1,678
Code:
[COLOR=#333333]Sub resetfilterstest()[/COLOR]
[COLOR=#333333]'[/COLOR]
[COLOR=#333333]' resetfilterstest Macro[/COLOR]
[COLOR=#333333]'[/COLOR]


[COLOR=#333333]'
On Error GoTo skipTheFilter
[/COLOR]
[COLOR=#333333]ActiveSheet.ShowAllData

[/COLOR]skipTheFilter:
[COLOR=#333333]Sheets("FrontEnd").Select[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 

Watch MrExcel Video

Forum statistics

Threads
1,108,908
Messages
5,525,577
Members
409,651
Latest member
Quasar Hunter

This Week's Hot Topics

Top