Autofilter choice


Posted by amroo on May 14, 2001 12:40 AM

Bonjour, I want to know if it's possible to put an autofilter on specific columns; Exple: C and F
The code below put autofilter on each columns C, D, E, F, or I just want it on C and F.
Here the code for selecting blank cells.
+++++++++++++++++++++++++++++++++++++++++++++++++
ActiveSheet.AutoFilterMode = False
Range("C4:F4").AutoFilter
Range("C4:F4").AutoFilter Field:=1, Criteria1:="="
Range("C4:F4").AutoFilter Field:=4, Criteria1:="="
++++++++++++++++++++++++++++++++++++++++++++++++++++
Thanks for suggestions.
A+mroo

Posted by Dave Hawley on May 14, 2001 3:12 AM

Field:=1, Criteria1:="=" Field:=4, Criteria1:="=" +++

Hi Amroo

I'm afraid it's not possible to use AutoFilter on two non contiguous ranges. But having said this, there is no advantage to placing them on the two cells. What you already have will work just fine.

Dave
OzGrid Business Applications



Posted by amroo on May 14, 2001 5:35 AM

Dave , here the entire code for autofilter , but when it runs it clears also all the cells after the range G12. I want just to make the autofilter runs in A5 to G12 and save the rest, I think that there is something to do on the line code:
ActiveSheet.UsedRange.Offset(4, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.ClearContents
'"""""""""""""""""""""""""""""""""""""""""
ActiveSheet.AutoFilterMode = False
Range("C4:F4").AutoFilter
Range("C4:F4").AutoFilter Field:=1, Criteria1:="="
Range("C4:F4").AutoFilter Field:=4, Criteria1:="="

ActiveSheet.UsedRange.Offset(4, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.ClearContents

ActiveSheet.AutoFilterMode = False

Range("A5:G12").Sort _
Key1:=Range("A5"), Order1:=xlAscending, _
Header:=xlNo, Orientation:=xlSortColumns
'"""""""""""""""""""""""""""""""""""""""""""""""
2OO1 Thanks. Amroo
nb: It's 14h35' here and at Perth 23h"35'?