macro error

R

robert_woodie

I am using this simple macro: (because i am a simple person)

sub reset()
ActiveSheet.ShowAllData
end sub

It resets all the filters on the sheet.

It works fine, apart from i get an error message if all the filters ar
already reset.

Is there any way of stoping this error?

Thanks in advance
Rober
 
D

DNF Karran

You could either have:

On error resume next

or trap the error and analyse it with

On error goto Err_Handle

and add line name Err_handle: with the way you want the error to b
handled.

For such a simple sub I would recommend the first option.

Dunca
 
R

Robert Christie

Hi Robert

one way

Sub ShowAll()
On Error GoTo away
ActiveSheet.ShowAllData
away:
End Sub

HTH
Bob C.
 
R

Robert Christie

Hi Robert
If your spreadsheet is large with many formulas to re-
calculate, this macro helps things speed up.

Sub Show_All_Data()

With Application
.Calculation = xlManual
End With
loopdeloop:
On Error GoTo errorhandler:
ActiveSheet.ShowAllData
GoTo loopdeloop
errorhandler:
With Application
.Calculation = xlAutomatic
End With
Range("B3").Select
'
End Sub

HTH
Bob C.
 
D

Dave Peterson

Two more:

on error resume next
activesheet.showalldata
on error goto 0

or

with activesheet
if .filtermode then
.showalldata
end if
end with
 
Top