Hide Some Filter Drop Down Arrows on AutoFilter

MikeMcCollister

Board Regular
Joined
May 6, 2020
Messages
71
Office Version
  1. 365
Platform
  1. Windows
I have some tables setup so that when data in one or two columns is changed (in other tables) then the auto filter will be re-run. What I want is that the first column of said tables to not have the drop down arrows. I can make all the drop down arrows to be hidden by using "ShowAutoFilterDropDown = True" but I don't want that. I only want the first column to not have a drop down arrow.

I've tried setting VsibleDropDown:=False but I get "invalid use of property".

Here is my VBA subroutine

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim table As ListObject
    Dim column As Long
   
    ' ??? todo: check if range is in a filtered table and don't do anything

    column = Target.column
   
    ' only do this if changes are made to column "E" or "F"
    If ((column = 5) Or (column = 6)) Then
        For Each table In ActiveSheet.ListObjects
            ' don't waste time on tables that don't have filters
            If (table.ShowAutoFilter) Then
           
                'table.AutoFilter Field:=1, VisibleDropDown:=False 'this gives "invalid use of property"
                'table.ShowAutoFilterDropDown = True 'don't want this
                table.AutoFilter.ApplyFilter
            End If
        Next table
    End If
End Sub

Any ideas how to do this?

Thanks,

Mike
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Fluff,

Thank you! I was missing "Range".

This is what works:

VBA Code:
table.Range.AutoFilter Field:=1, VisibleDropDown:=False

Regards,

Mike
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,832
Messages
6,127,149
Members
449,365
Latest member
AlienSx

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