macro error

  • Thread starter Thread starter robert_woodie
  • Start date Start date
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
 
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
 
Hi Robert

one way

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

HTH
Bob C.
 
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.
 
Two more:

on error resume next
activesheet.showalldata
on error goto 0

or

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top