what's happening here? autofilters

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,008
Office Version
  1. 365
Platform
  1. Windows
I am unhiding two sheets and removing the autofilters from the table on each sheet. or, atleast, i am trying to do that. my second .showalldata keeps bugging out with an object variable or with block variable not set error.
Code:
With Worksheets("T1 Download")
        If Not .AutoFilterMode Then
            .Range("A5").AutoFilter
        End If
            'apply filter to include only Approved and Suspended to Contract Status
            .ListObjects("Table1").AutoFilter.ShowAllData
    End With
    
    With Worksheets("P6Detailed Resource Allocation ")
        If Not .AutoFilterMode Then
            .Range("A3").AutoFilter
        End If
            'apply filter to exclude blank Descriptions
            .ListObjects("P6DetlResAlloc").AutoFilter.ShowAllData
    End With
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
when running the macro that contains the above snippet, the two sheets are unhidden, and the T1 Download sheet behaves as it should. that is, autofilters are cleared. as for the P6 sheet, it is unhidden, but autofilters are completely removed, which is where i get the error message.
 
Upvote 0
have settled for remove filters, re-add filters, using:
[code
.ShowAutoFilter = False
.ShowAutoFilter = True[/code]

This is to clear (not remove) any filters that have been applied.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,409
Messages
6,124,733
Members
449,185
Latest member
hopkinsr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top