View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Programmatically removing data filters

I'll get it right in a minute

With ActiveSheet
On Error Resume Next
If .AutoFilterMode = True Then
.ShowAllData
End If
End With

Mike

"Mike H" wrote:

apologies that will remove the filter and I think you want to reset it to
all. Try this

With ActiveSheet
If .AutoFilterMode Then
.ShowAllData
End If
End With

Mike

"Mike H" wrote:

Try

If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False

Mike

"PatK" wrote:

I have a spreadsheet that, using VBA macros, I add rows to the end of the
table, based upon data in a database. HOwever, I have found that, if, for
whatever reason, I have a filter set on one or more columns at the time I
attempt the update, I get an error in the VBA code. My work around is to
simply ensure I have no filters set, before I run the code, but it would be
great if I could programmatically "unset" all filters on all columns, before
I do the row add activity.

Is there a quick/dirty way to do that?

thanks!

Patk