Autofilter fails to sort data.

Closed
Carman - Jul 14, 2010 at 03:43 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Jul 18, 2010 at 08:55 AM
Hello,
i am trying to use Autofilter to do some sortings and record them via macro. The autofilter itself is OK, but when i assign it to a macro, the "heading" of the colum are all gone. What can i do to keep the heading?

The macro code i record:

Range("F1:N1").Select
Selection.AutoFilter Field:=9, Criteria1:="Pending"
Range("F1:R228").Sort Key1:=Range("L1"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
SortMethod:=xlStroke, DataOption1:=xlSortNormal
Selection.AutoFilter Field:=2, Criteria1:="="

P.S. Does it make a difference if i use VBA scripts instead of using Autofilter function?

Thanks!!


2 responses

bascially, my heading got filtered away.
All i want to do is REMOVE rows that
1) without the word "pending"
2) NOT blank
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jul 18, 2010 at 08:55 AM
Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc and post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too