T2B explained on 7/13/2011 :
Filtering across sheets with same same filter headers I am using this
but occasionally will get the error listed below. Other times it
works fine. Please help if you can see the error in my ways.
It usually is necessary to do '.AutoFilter' followed by:
'.AutoFilter Field:=...' on the specified range so errors don't
occur.
Not sure why you're using 'AutoFilter.Range' here. IOW, specify the
range to filter something like this...
Sub filterSHEETS(ReturnArray() As String, iField As Integer, _
RangeToFilter As Range)
Dim astrItems() As String '//what purpose does this serve?
Dim wks As Worksheet
'Dim strSheetName As String '//not really needed
For Each wks In ActiveWorkbook.Worksheets
With wks
Select Case .Name
Case "Amenity", "Benchmark", "Rate", "Volume", _
"Negotiation Tool Report"
.Select
With .Range(RangeToFilter)
.AutoFilter
.AutoFilter Field:=iField, _
Criteria1:=ReturnArray, _
Operator:=xlFilterValues
End With '.RangeToFilter
End Select 'Case .Name
End With 'wks
Next wks
End Sub
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc