ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   auto filter (https://www.excelbanter.com/excel-programming/292225-auto-filter.html)

monika

auto filter
 

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


Rob van Gelder[_4_]

auto filter
 
'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



--
Rob van Gelder - http://www.vangelder.co.nz/excel


"monika" wrote in message
...

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




monika

auto filter
 
thanks...!
"Rob van Gelder" wrote in message
...
'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



--
Rob van Gelder - http://www.vangelder.co.nz/excel


"monika" wrote in message
...

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







All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com