Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Applying two or more filters through VB

Hi all.

I have a spreadsheet whith approx 30 colums, all theses
have an autofilter applied. I also have buttons that
users can click on to apply a filter.

When user clicks on btn filter;
Selection.AutoFilter Field:=27, Criteria1:="="

Then when user applies a second filter (code as below),
nothing happens.
Selection.AutoFilter Field:=26, Criteria1:="0"

Each filter works fine individually, but not together.
Does anyone know why? and what solutions there might be?

Thanks in advance.

Steve.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Applying two or more filters through VB

Stepnen,
Try this
Sub FilterTest()
Range("TestRange").SpecialCells(xlVisible) _
..AutoFilter Field:=Range("I1").Value, _
Criteria1:=Range("K1").Value
End Sub
"TestRange" is the name given to the Range
HTH
Cecil

"Stepnen" wrote in message
...
Hi all.

I have a spreadsheet whith approx 30 colums, all theses
have an autofilter applied. I also have buttons that
users can click on to apply a filter.

When user clicks on btn filter;
Selection.AutoFilter Field:=27, Criteria1:="="

Then when user applies a second filter (code as below),
nothing happens.
Selection.AutoFilter Field:=26, Criteria1:="0"

Each filter works fine individually, but not together.
Does anyone know why? and what solutions there might be?

Thanks in advance.

Steve.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Applying two or more filters through VB

Hi Cecil, thanks for your help, but I can't seem to get
this to compile..
My range is named as ReportData
The _ does not compile ...so Ive deleted it, then it
provides the error that AutoFilter is an "invalid use of
property".

-----Original Message-----
Stepnen,
Try this
Sub FilterTest()
Range("TestRange").SpecialCells(xlVisible) _
..AutoFilter Field:=Range("I1").Value, _
Criteria1:=Range("K1").Value
End Sub
"TestRange" is the name given to the Range
HTH
Cecil

"Stepnen" wrote in

message
...
Hi all.

I have a spreadsheet whith approx 30 colums, all theses
have an autofilter applied. I also have buttons that
users can click on to apply a filter.

When user clicks on btn filter;
Selection.AutoFilter Field:=27, Criteria1:="="

Then when user applies a second filter (code as below),
nothing happens.
Selection.AutoFilter Field:=26, Criteria1:="0"

Each filter works fine individually, but not together.
Does anyone know why? and what solutions there might be?

Thanks in advance.

Steve.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Applying two or more filters through VB

Can you manually apply the two filters to your data and get a change.

It sounds to me that the first filter applied has eliminated any records
that the second filter would affect. In otherwords, there are no records
that have a blank in column 27 and a zero in column 26.

--
Regards,
Tom Ogilvy

"Stepnen" wrote in message
...
Hi Cecil, thanks for your help, but I can't seem to get
this to compile..
My range is named as ReportData
The _ does not compile ...so Ive deleted it, then it
provides the error that AutoFilter is an "invalid use of
property".

-----Original Message-----
Stepnen,
Try this
Sub FilterTest()
Range("TestRange").SpecialCells(xlVisible) _
..AutoFilter Field:=Range("I1").Value, _
Criteria1:=Range("K1").Value
End Sub
"TestRange" is the name given to the Range
HTH
Cecil

"Stepnen" wrote in

message
...
Hi all.

I have a spreadsheet whith approx 30 colums, all theses
have an autofilter applied. I also have buttons that
users can click on to apply a filter.

When user clicks on btn filter;
Selection.AutoFilter Field:=27, Criteria1:="="

Then when user applies a second filter (code as below),
nothing happens.
Selection.AutoFilter Field:=26, Criteria1:="0"

Each filter works fine individually, but not together.
Does anyone know why? and what solutions there might be?

Thanks in advance.

Steve.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Applying two or more filters through VB

Yes. If I manually apply the change it works... After the
first filter is applied, there is still records (rows)
that could be filtered out by the second.. but it does not
work. Also whwn a filter is aplied the drop down filter
goes blue, but of cause mine does not work.. please help.

-----Original Message-----
Can you manually apply the two filters to your data and

get a change.

It sounds to me that the first filter applied has

eliminated any records
that the second filter would affect. In otherwords, there

are no records
that have a blank in column 27 and a zero in column 26.

--
Regards,
Tom Ogilvy

"Stepnen" wrote in

message
...
Hi Cecil, thanks for your help, but I can't seem to get
this to compile..
My range is named as ReportData
The _ does not compile ...so Ive deleted it, then it
provides the error that AutoFilter is an "invalid use of
property".

-----Original Message-----
Stepnen,
Try this
Sub FilterTest()
Range("TestRange").SpecialCells(xlVisible) _
..AutoFilter Field:=Range("I1").Value, _
Criteria1:=Range("K1").Value
End Sub
"TestRange" is the name given to the Range
HTH
Cecil

"Stepnen" wrote

in
message
...
Hi all.

I have a spreadsheet whith approx 30 colums, all

theses
have an autofilter applied. I also have buttons that
users can click on to apply a filter.

When user clicks on btn filter;
Selection.AutoFilter Field:=27, Criteria1:="="

Then when user applies a second filter (code as

below),
nothing happens.
Selection.AutoFilter Field:=26, Criteria1:="0"

Each filter works fine individually, but not

together.
Does anyone know why? and what solutions there might

be?

Thanks in advance.

Steve.


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Applying two or more filters through VB

I have never had a problem with applying an autofilter.

--
Regards,
Tom Ogilvy

"Stepnen" wrote in message
...
Yes. If I manually apply the change it works... After the
first filter is applied, there is still records (rows)
that could be filtered out by the second.. but it does not
work. Also whwn a filter is aplied the drop down filter
goes blue, but of cause mine does not work.. please help.

-----Original Message-----
Can you manually apply the two filters to your data and

get a change.

It sounds to me that the first filter applied has

eliminated any records
that the second filter would affect. In otherwords, there

are no records
that have a blank in column 27 and a zero in column 26.

--
Regards,
Tom Ogilvy

"Stepnen" wrote in

message
...
Hi Cecil, thanks for your help, but I can't seem to get
this to compile..
My range is named as ReportData
The _ does not compile ...so Ive deleted it, then it
provides the error that AutoFilter is an "invalid use of
property".

-----Original Message-----
Stepnen,
Try this
Sub FilterTest()
Range("TestRange").SpecialCells(xlVisible) _
..AutoFilter Field:=Range("I1").Value, _
Criteria1:=Range("K1").Value
End Sub
"TestRange" is the name given to the Range
HTH
Cecil

"Stepnen" wrote

in
message
...
Hi all.

I have a spreadsheet whith approx 30 colums, all

theses
have an autofilter applied. I also have buttons that
users can click on to apply a filter.

When user clicks on btn filter;
Selection.AutoFilter Field:=27, Criteria1:="="

Then when user applies a second filter (code as

below),
nothing happens.
Selection.AutoFilter Field:=26, Criteria1:="0"

Each filter works fine individually, but not

together.
Does anyone know why? and what solutions there might

be?

Thanks in advance.

Steve.


.



.



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
Can I use "OR" in two auto-filters/custom filters? Roady Excel Discussion (Misc queries) 1 May 24th 10 06:11 PM
Pivot Table filters, especially DATE filters chris Excel Worksheet Functions 0 August 27th 08 04:33 AM
How to copy with filters but not copy the filters in the middle? ztalove Excel Discussion (Misc queries) 0 November 1st 06 04:53 PM
Filters, Subtotal & Intacted Results after the filters' Removal kasiopi Excel Discussion (Misc queries) 5 February 24th 06 12:18 PM
Applying formulae ali Excel Programming 8 December 14th 03 01:46 AM


All times are GMT +1. The time now is 06:51 PM.

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

About Us

"It's about Microsoft Excel"