PC Review


Reply
Thread Tools Rate Thread

Autofilter show all

 
 
Mia
Guest
Posts: n/a
 
      31st Jul 2008
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.AutoFilter Field:=5,
Criteria1 _
:="A"

ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=36,
Criteria1 _
:="<>"


End Sub

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      31st Jul 2008
You want to show all the data before you apply the different filtering?

Activesheet.ListObjects("Tabell1012").Range.AutoFilter

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.AutoFilter Field:=5,
> Criteria1 _
> :="A"
>
> ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=36,
> Criteria1 _
> :="<>"
>
>
> End Sub


--

Dave Peterson
 
Reply With Quote
 
Mia
Guest
Posts: n/a
 
      1st Aug 2008
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.AutoFilter
>
> 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.AutoFilter Field:=5,
> > Criteria1 _
> > :="A"
> >
> > ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=36,
> > Criteria1 _
> > :="<>"
> >
> >
> > End Sub

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Mia
Guest
Posts: n/a
 
      1st Aug 2008
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.AutoFilter
ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=5,
Criteria1 _
:="AAB"

ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter 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.AutoFilter
>
> 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.AutoFilter Field:=5,
> > Criteria1 _
> > :="A"
> >
> > ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=36,
> > Criteria1 _
> > :="<>"
> >
> >
> > End Sub

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Aug 2008
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.AutoFilter
> ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=5,
> Criteria1 _
> :="AAB"
>
> ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter 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.AutoFilter
> >
> > 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.AutoFilter Field:=5,
> > > Criteria1 _
> > > :="A"
> > >
> > > ActiveSheet.ListObjects("Tabell1012").Range.AutoFilter Field:=36,
> > > Criteria1 _
> > > :="<>"
> > >
> > >
> > > End Sub

> >
> > --
> >
> > Dave Peterson
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro / Autofilter / Show All Data CousinExcel Microsoft Excel Misc 3 17th Feb 2010 01:28 PM
autofilter show all data RN Mark Microsoft Excel Misc 5 10th May 2009 12:24 PM
AutoFilter results plus show next row =?Utf-8?B?UkFQ?= Microsoft Excel Programming 2 7th Aug 2007 05:54 PM
Why does AutoFilter not show all the data in the pull down? =?Utf-8?B?c2Fjd2lhMDE=?= Microsoft Excel Misc 3 4th Oct 2005 07:41 PM
In VBA set Slection.AutoFilter show all Djmask Microsoft Excel Programming 4 18th Aug 2005 06:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:46 AM.