Evagrius Ponticus
Well-known Member
- Joined
- May 24, 2007
- Messages
- 1,467
Hi All,
I have this code that works almost as I want it. I have a sheet that is autofiltered. Once a user autofilters columns 20, I would like to hide the arrow for that column so the user can no longer autofilter using that column. When I run the code - it hides the arrow in column 20, but then it unfilters all the data . . . can I hide the arrow in column 20 but keep the data as it was filtered before the code ran?? Thanks,
I have this code that works almost as I want it. I have a sheet that is autofiltered. Once a user autofilters columns 20, I would like to hide the arrow for that column so the user can no longer autofilter using that column. When I run the code - it hides the arrow in column 20, but then it unfilters all the data . . . can I hide the arrow in column 20 but keep the data as it was filtered before the code ran?? Thanks,
Code:
Dim c As Range
Dim i As Integer
i = Cells(2, 1).End(xlToRight).Column
Application.ScreenUpdating = False
For Each c In Range(Cells(2, 1), Cells(1, i))
If c.Column = 20 Then
c.AutoFilter Field:=c.Column, _
Visibledropdown:=False
End If
Next
End Sub