Thread: autofilter
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Geebee Geebee is offline
external usenet poster
 
Posts: 28
Default autofilter

hi,

I am getting the following error message:

runtime error 1004 unable to get the autofilter property of the range class

as a result of the following code:

Sheets("NewBKInput").Visible = True
Sheets("NewBKInput").Activate
Sheets("NewBKInput").Select

'sort the month column before selecting the oldest month
If Selection.AutoFilter = True Then
Selection.AutoFilter 'turn off autofilter option
End If

How can I fix this? I do not understand why the following code (which
appears above the code above) works fine:

Sheets("Input1").Visible = True
Sheets("Input1").Activate
Sheets("Input1").Select


'sort the month column before selecting the oldest month
If Selection.AutoFilter = True Then
Selection.AutoFilter 'turn off autofilter option
End If
Columns("A:O").Select

Thanks in advance,
geebee