Autofilter fails to sort data.

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
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 replies

bascially, my heading got filtered away.
All i want to do is REMOVE rows that
1) without the word "pending"
2) NOT blank
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
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