VB Error when AutoFiltering a Pivottable

J

jxbeeman

Hi,
I'm trying to run an autofilter in my macro on a pivottable. But when i run
the macro, as soon as it gets to the part where it should autofilter and
select the filter criteria, it pops up an error. Anyone have a similar
experience. Any help would be greatly appreciated.

Code:
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("I4").Select
Selection.AutoFilter
ActiveSheet.Range("$A$4:$H$169").AutoFilter Field:=1,
Criteria1:="=*total*" _
, Operator:=xlAnd
ActiveWindow.SmallScroll Down:=-15

Thanks,
Josh
 
S

Storm

I think the problem lies in this:

Range("I4").Select
Selection.AutoFilter
ActiveSheet.Range("$A$4:$H$169").AutoFilter Field:=1,
Criteria1:="=*total*" _
, Operator:=xlAnd

You have only selected I4 to be filtered but then you're filtering A4 to
H169? What is the cell range of the data you want to be filtered? And what
column is the filtered list in (*total*)?

Storm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top