ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter sorting. (https://www.excelbanter.com/excel-programming/422933-autofilter-sorting.html)

LaDdIe

Autofilter sorting.
 
Hiya

I have 6 columns with autofilter enabled.

I have been able to select autofilter via VBA as follows;
Selection.AutoFilter Field:=6, Criteria1:="TEB"
And all is fine

However I also want to sort column 1 in ascending order,
Selection.AutoFilter Field:=1 Order1:=xlAscending
But I can't get it right!

Can anyone in this forum help

With Thanks

Don Guillett

Autofilter sorting.
 

Have you tried sorting first and then filtering.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"LaDdIe" wrote in message
...
Hiya

I have 6 columns with autofilter enabled.

I have been able to select autofilter via VBA as follows;
Selection.AutoFilter Field:=6, Criteria1:="TEB"
And all is fine

However I also want to sort column 1 in ascending order,
Selection.AutoFilter Field:=1 Order1:=xlAscending
But I can't get it right!

Can anyone in this forum help

With Thanks



LaDdIe

Autofilter sorting.
 
would be easier to sort on demand,
I assume that it's not possible to sort in the same way as
Selection.AutoFilter Field:=6, Criteria1:="TEB" ?

Thanks anyway though

"Don Guillett" wrote:


Have you tried sorting first and then filtering.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"LaDdIe" wrote in message
...
Hiya

I have 6 columns with autofilter enabled.

I have been able to select autofilter via VBA as follows;
Selection.AutoFilter Field:=6, Criteria1:="TEB"
And all is fine

However I also want to sort column 1 in ascending order,
Selection.AutoFilter Field:=1 Order1:=xlAscending
But I can't get it right!

Can anyone in this forum help

With Thanks




Roger Govier[_3_]

Autofilter sorting.
 
Hi

Provided you have made your selection, then

Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:= _
xlGuess, Orientation:=xlTopToBottom

--
Regards
Roger Govier

"LaDdIe" wrote in message
...
Hiya

I have 6 columns with autofilter enabled.

I have been able to select autofilter via VBA as follows;
Selection.AutoFilter Field:=6, Criteria1:="TEB"
And all is fine

However I also want to sort column 1 in ascending order,
Selection.AutoFilter Field:=1 Order1:=xlAscending
But I can't get it right!

Can anyone in this forum help

With Thanks




All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com