This code works well for turning on the Auto Filter
for a dynamically determined used range if the filter happens to accidentally be turned off.
My reason for it is because the Row Headers are on row 15, but there is also data on rows 1 thru 14
* I would like to disable the ability for the user to turn the filter on manually.
The method will need to work in both Excel 2003 and 2007
Thanks in advance for any ideas.
Code:Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'If Filter is off, this code works well to turn it on to a semi-dynamically determined UsedRange Dim rng As Range Dim wks As Object Dim LastRow As Long Set wks = ActiveSheet With wks LastRow = .[B65536].End(xlUp).Row Set rng = .Range(.Cells(15, 1), .Cells(LastRow, 23))'Range= Row(15) to Col(23) to Last data Row If Not .AutoFilterMode Then rng.AutoFilter End If .EnableAutoFilter = True End With End Sub




Reply With Quote