Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Autofiltering macro does not work correctly

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Autofiltering macro does not work correctly

Try placing "Selection.Autofilter" just before each autofilter command.
--
Best wishes,

Jim


"fermerlo" wrote:

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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Autofiltering macro does not work correctly

Looks like you need to add this:

Range("AC9").Select

right after your first PrintOut.

--
Dan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop does not work correctly [email protected] Excel Programming 3 August 23rd 06 12:27 AM
Can't get the find statement to work correctly sc Excel Programming 1 July 1st 06 11:58 PM
Reg autofiltering using macro in excel with out providing criteria Juno Excel Worksheet Functions 4 May 28th 06 05:48 PM
How do I get Auto-Fit to work correctly? Mickey Dunne Excel Worksheet Functions 0 May 11th 06 01:47 AM
custom filter does not work correctly RJ Excel Discussion (Misc queries) 1 September 9th 05 07:34 PM


All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"