Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro / Autofilter / Show All Data CousinExcel Excel Discussion (Misc queries) 3 February 17th 10 01:28 PM
autofilter show all data RN Mark Excel Discussion (Misc queries) 5 May 10th 09 12:24 PM
AutoFilter results plus show next row RAP Excel Programming 2 August 7th 07 05:54 PM
Autofilter- show dates differently lunker55 Excel Discussion (Misc queries) 3 November 10th 05 06:58 PM
In VBA set Slection.AutoFilter show all Djmask Excel Programming 4 August 18th 05 06:10 PM


All times are GMT +1. The time now is 05:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"