Autofilter show all
Hi,
I´m trying to do a autofiltermacro that will work with different buttons. It should work like this: Button 1, Selects and filter field 5 and 32 Button 2, Selects and filter field 5 and 36 and so on. The problem is that it only adds on. If I fist clicks on button 1 and then 2 field 32 still is filtered. How should I do this? BR Mia My code so far is: Sub Amars() ' ' Amars Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="A" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=36, Criteria1 _ :="<" End Sub |
Autofilter show all
You want to show all the data before you apply the different filtering?
Activesheet.ListObjects("Tabell1012").Range.AutoFi lter ps. If you decide to use the "normal" data|filter, you could use: with activesheet If .FilterMode Then .ShowAllData End If End with to show all the data Mia wrote: Hi, I´m trying to do a autofiltermacro that will work with different buttons. It should work like this: Button 1, Selects and filter field 5 and 32 Button 2, Selects and filter field 5 and 36 and so on. The problem is that it only adds on. If I fist clicks on button 1 and then 2 field 32 still is filtered. How should I do this? BR Mia My code so far is: Sub Amars() ' ' Amars Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="A" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=36, Criteria1 _ :="<" End Sub -- Dave Peterson |
Autofilter show all
Thank you!
It worked perfect! BR Mia "Dave Peterson" skrev: You want to show all the data before you apply the different filtering? Activesheet.ListObjects("Tabell1012").Range.AutoFi lter ps. If you decide to use the "normal" data|filter, you could use: with activesheet If .FilterMode Then .ShowAllData End If End with to show all the data Mia wrote: Hi, I´m trying to do a autofiltermacro that will work with different buttons. It should work like this: Button 1, Selects and filter field 5 and 32 Button 2, Selects and filter field 5 and 36 and so on. The problem is that it only adds on. If I fist clicks on button 1 and then 2 field 32 still is filtered. How should I do this? BR Mia My code so far is: Sub Amars() ' ' Amars Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="A" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=36, Criteria1 _ :="<" End Sub -- Dave Peterson |
Autofilter show all
Hello again,
I hope you can give me some more advice. Im trying to sort after a specifik cell. But I dont get it to work. My cell is D5 in the active sheet. Howe should I write my code. Now my code is: Sub A() ' ' Sortera januari i betaltlistan Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="AAB" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=32, Criteria1 _ :="<" End Sub BR Mia "Dave Peterson" skrev: You want to show all the data before you apply the different filtering? Activesheet.ListObjects("Tabell1012").Range.AutoFi lter ps. If you decide to use the "normal" data|filter, you could use: with activesheet If .FilterMode Then .ShowAllData End If End with to show all the data Mia wrote: Hi, I´m trying to do a autofiltermacro that will work with different buttons. It should work like this: Button 1, Selects and filter field 5 and 32 Button 2, Selects and filter field 5 and 36 and so on. The problem is that it only adds on. If I fist clicks on button 1 and then 2 field 32 still is filtered. How should I do this? BR Mia My code so far is: Sub Amars() ' ' Amars Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="A" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=36, Criteria1 _ :="<" End Sub -- Dave Peterson |
Autofilter show all
Maybe...
With ActiveSheet.ListObjects("Tabell1012").Range .Cells.Sort key1:=.Columns(4), Order1:=xlAscending, _ Header:=xlYes End With I assumed that column D is the 4th column in the list range. But that may not be true... Mia wrote: Hello again, I hope you can give me some more advice. Im trying to sort after a specifik cell. But I dont get it to work. My cell is D5 in the active sheet. Howe should I write my code. Now my code is: Sub A() ' ' Sortera januari i betaltlistan Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="AAB" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=32, Criteria1 _ :="<" End Sub BR Mia "Dave Peterson" skrev: You want to show all the data before you apply the different filtering? Activesheet.ListObjects("Tabell1012").Range.AutoFi lter ps. If you decide to use the "normal" data|filter, you could use: with activesheet If .FilterMode Then .ShowAllData End If End with to show all the data Mia wrote: Hi, I´m trying to do a autofiltermacro that will work with different buttons. It should work like this: Button 1, Selects and filter field 5 and 32 Button 2, Selects and filter field 5 and 36 and so on. The problem is that it only adds on. If I fist clicks on button 1 and then 2 field 32 still is filtered. How should I do this? BR Mia My code so far is: Sub Amars() ' ' Amars Makro ' ' ActiveSheet.Unprotect ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=5, Criteria1 _ :="A" ActiveSheet.ListObjects("Tabell1012").Range.AutoFi lter Field:=36, Criteria1 _ :="<" End Sub -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 06:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com