Hide Filter Arrows

adamsm

Active Member
Joined
Apr 20, 2010
Messages
444
How could I make the following code to hide all the filter arrows including the column 2?

I've applied filter to row 10. Starting from columns C to K.

Code:
Sub HideArrows()
'hides all arrows except column 2
Dim c As Range
Dim i As Integer
i = Cells(1, 1).End(xlToRight).Column
Application.ScreenUpdating = False
For Each c In Range(Cells(1, 1), Cells(1, i))
 If c.Column <> 2 Then
  c.AutoFilter Field:=c.Column, _
    Visibledropdown:=False
 End If
Next
Application.ScreenUpdating = True
End Sub
Thanks in advance.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Why do you need a macro to do that? You can just click the filter button in the toolbar to remove them.
 
Upvote 0
Because I do not want to keep the filter arrows visible but to filter the sheet with the help of another code.
 
Upvote 0
As soon as you hide the arrow on the column that is being filtered it will show the hidden rows anyway.

You need to work on the logic of

Code:
Sub hidefilter()
Application.ScreenUpdating = False
' select range not hidden by filters
ActiveSheet.UsedRange.SpecialCells(xlCellTypeVisible).Select
' remove filter and show the hidden rows
Selection.AutoFilter
' hide everything
ActiveSheet.UsedRange.EntireRow.Hidden = True
' unhide the filter selection
Selection.EntireRow.Hidden = False
Application.ScreenUpdating = True
End Sub

I've gone with hiding then unhiding as there is no invert selection (that I can find) in excel, can probably be improved, but this is a quick test to make sure I'm on the right lines of what you need.
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

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