View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default How can I get a macro to know when it false and run a different ma

Showall data fails becuase you don't have aoutfiltering on. You need to test
for auto filtering as follows:

Sub test()

With ActiveSheet
If .AutoFilterMode Then
.ShowAllData
Else
' enter your alternate code
End If
End With

End Sub


"Shawn777" wrote:

If the macro / code turns out to be an error Then run a different macro.

The code is:
ActiveSheet.ShowAllData

but if it is already showing all then the macro shuts down with an error
message.
Instead I want it to realize it doesnt work and run a different macro
instead.