auto filter

  • Thread starter Thread starter monika
  • Start date Start date
M

monika

Can I check for a condition that if the sheet has auto
filter for a row then
it should deactivate....i.e. remove the auto filter and if
not found then
leave as it is.

I tried Selection.Autofilter. Using this I can remove the
auto filter if its
present but if not there then it puts it!

How can I check such a case

Thanks
Monika
 
'This shows all the data if the list os filtered
Sub test()
With ActiveSheet
If .FilterMode Then .ShowAllData
End With
End Sub

'This removes the autofilter altogether
Sub test2()
With ActiveSheet
If .AutoFilterMode Then .AutoFilterMode = False
End With
End Sub
 
thanks...!
Rob van Gelder said:
'This shows all the data if the list os filtered
Sub test()
With ActiveSheet
If .FilterMode Then .ShowAllData
End With
End Sub

'This removes the autofilter altogether
Sub test2()
With ActiveSheet
If .AutoFilterMode Then .AutoFilterMode = False
End With
End Sub
 

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