ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What if AutoFilter is NOT on? (https://www.excelbanter.com/excel-programming/305770-what-if-autofilter-not.html)

Ed[_18_]

What if AutoFilter is NOT on?
 
I've spent some time here getting tips and code on incrementing through an
AutoFiltered range. Thanks to the great efforts of good people much smarter
than I, these macros work wonders for me. Now I "broke" one - by trying to
use it on an UNfiltered workbook! It errored on the line:
Set rng = ActiveSheet.AutoFilter.Range


What is the best way to handle this? On Error Resume Next? Or is there a
test: "If AutoFilter = True Then"?

Ed



Norman Jones

What if AutoFilter is NOT on?
 
Hi Ed

To Test for an autofilter, you can use the AutofilterMode property::

If Activesheet.AutoFilterMode Then
'There is an autofilter
'Do something
Else
'No autofilter
'Do something else
End If

If you need to check if any rows are hidden by a filter, use the FilterMode
property.

---
Regards,
Norman



"Ed" wrote in message
...
I've spent some time here getting tips and code on incrementing through an
AutoFiltered range. Thanks to the great efforts of good people much

smarter
than I, these macros work wonders for me. Now I "broke" one - by trying

to
use it on an UNfiltered workbook! It errored on the line:
Set rng = ActiveSheet.AutoFilter.Range


What is the best way to handle this? On Error Resume Next? Or is there a
test: "If AutoFilter = True Then"?

Ed





Ed[_18_]

What if AutoFilter is NOT on?
 
Thanks, Norman. I appreciate the boost.

Ed

"Norman Jones" wrote in message
...
Hi Ed

To Test for an autofilter, you can use the AutofilterMode property::

If Activesheet.AutoFilterMode Then
'There is an autofilter
'Do something
Else
'No autofilter
'Do something else
End If

If you need to check if any rows are hidden by a filter, use the

FilterMode
property.

---
Regards,
Norman



"Ed" wrote in message
...
I've spent some time here getting tips and code on incrementing through

an
AutoFiltered range. Thanks to the great efforts of good people much

smarter
than I, these macros work wonders for me. Now I "broke" one - by trying

to
use it on an UNfiltered workbook! It errored on the line:
Set rng = ActiveSheet.AutoFilter.Range


What is the best way to handle this? On Error Resume Next? Or is there

a
test: "If AutoFilter = True Then"?

Ed








All times are GMT +1. The time now is 10:33 AM.

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