Autofiltering macro does not work correctly

G

Guest

Hi!

I would like to know if somebody can help me, i have some macros with
autofilter that doesn´t work correclty. When i run them, the first filter
works well but the second time it seems like there aren't anything.

If i do it manually there are the information i asking for but when i run
the macro it doesn't filter.

In fact, when i ask for all columns by the mecro code it only shows the
titles with no information. But if i do it manually it works ok.

I´m putting the code but i´m almost sure it is ok because some weeks before
it did it well and i didn´t change it.

I tried doing that file again and reccording a new macro but when i was
recording it it ran perfectly well but when i ran the macro it did it again.

Please hel me, i´m desesperate.

This is the code.

Columns("B:E").Select
Selection.EntireColumn.Hidden = True
Range("A6:O430").Select
ActiveSheet.PageSetup.PrintArea = "$A$6:$O$430"
Range("AE8").Select
ActiveCell.FormulaR1C1 = "2"
Range("AE9").Select
Selection.AutoFilter Field:=31, Criteria1:="CONF" ((IT WORKS))
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Selection.AutoFilter Field:=29, Criteria1:="CETES" (((IT DOESN´T FILTER)))
Range("J6:O7").Select
ActiveWindow.SelecteSheets.PrintOut Copies:=1, Collate:=True
Range("AE8").Select
ActiveCell.FormulaR1C1 = "17"
Range("AE9").Select
Selection.AutoFilter Field:=31, Criteria1:="CONF" (((IT DOESN´T FILTER)))
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("AC9").Select
Selection.AutoFilter Field:=29 (((IT DOESN´T FILTER)))
Range("AE8").Select
ActiveCell.FormulaR1C1 = "10"
Range("AE9").Select
Selection.AutoFilter Field:=31, Criteria1:="CONF" (((IT DOESN´T FILTER)))
Range("J8").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("AE9").Select
Selection.AutoFilter Field:=31 (((IT DOESN´T FILTER ANYTHING)))


THANK U VERY MUCH!
 
D

Dan R.

Looks like you need to add this:

Range("AC9").Select

right after your first PrintOut.
 

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