Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
CC CC is offline
external usenet poster
 
Posts: 91
Default Change criteria in a CF

Hi to all
I've did a CF like the example below
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=*WARNING*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd

Is possible change the criteria withoult change the macro e.g insert
the criteria word in a cell P1 .
Appreciate any help

CC

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Change criteria in a CF

Something like this:

Selection.AutoFilter Field:=3, Criteria1:="=*" & Range("P1")Value & "*"
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"CC" wrote:

Hi to all
I've did a CF like the example below
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=*WARNING*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd

Is possible change the criteria withoult change the macro e.g insert
the criteria word in a cell P1 .
Appreciate any help

CC

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Change criteria in a CF

Not 100% sure what you want here. Did you want the filter to change when
someone changes the value in Cell P1? You r current filter has 2 criteria.
Which on eis this???
--
HTH...

Jim Thomlinson


"CC" wrote:

Hi to all
I've did a CF like the example below
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=*WARNING*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd

Is possible change the criteria withoult change the macro e.g insert
the criteria word in a cell P1 .
Appreciate any help

CC

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Change criteria in a CF

You need to have Worksheet change event code to re-apply the filter when cell P1 changes, and change
the code from

Criteria1:="=*WARNING*"

to

Criteria1:="=*" & Worksheet("SName").Range("P1").VAlue * "*"


HTH,
Bernie
MS Excel MVP


"CC" wrote in message
...
Hi to all
I've did a CF like the example below
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=*WARNING*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd

Is possible change the criteria withoult change the macro e.g insert
the criteria word in a cell P1 .
Appreciate any help

CC



  #5   Report Post  
Posted to microsoft.public.excel.misc
CC CC is offline
external usenet poster
 
Posts: 91
Default Change criteria in a CF

Both

"Jim Thomlinson" wrote:

Not 100% sure what you want here. Did you want the filter to change when
someone changes the value in Cell P1? You r current filter has 2 criteria.
Which on eis this???
--
HTH...

Jim Thomlinson


"CC" wrote:

Hi to all
I've did a CF like the example below
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=*WARNING*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd

Is possible change the criteria withoult change the macro e.g insert
the criteria word in a cell P1 .
Appreciate any help

CC



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Change criteria in a CF

Here is some code that might do the trick. I do not know which range you want
filtered so this is the best I can give you for now...

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address = "$P$1" then
with Range("A1:N10000")
.AutoFilter
.AutoFilter Field:=3, Criteria1:="=*" & .range("P1").value & "*",
Operator:=xlAnd
.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd
end with
end if
end sub

This code needs to be placed in the worksheet. Right click the sheet tab and
select view code. Paste the code in there...
--
HTH...

Jim Thomlinson


"CC" wrote:

Both

"Jim Thomlinson" wrote:

Not 100% sure what you want here. Did you want the filter to change when
someone changes the value in Cell P1? You r current filter has 2 criteria.
Which on eis this???
--
HTH...

Jim Thomlinson


"CC" wrote:

Hi to all
I've did a CF like the example below
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=*WARNING*", Operator:=xlAnd
Selection.AutoFilter Field:=9, Criteria1:="=*Pressure*", Operator:=xlAnd

Is possible change the criteria withoult change the macro e.g insert
the criteria word in a cell P1 .
Appreciate any help

CC

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
Change Row Colour if certain criteria is met Steven Excel Worksheet Functions 2 May 6th 09 01:43 PM
auto set time(now) if criteria=true with no later change Rafi Benami Excel Worksheet Functions 1 April 24th 07 05:57 AM
Change text based on other cell criteria? ansoriano1 Excel Worksheet Functions 2 August 23rd 06 12:02 AM
Based on one cell criteria to change the rest of that row to a col Rochelle B Excel Discussion (Misc queries) 7 November 13th 05 02:42 AM
how do I change the font of a cell if it meets a certain criteria. Meaux Excel Worksheet Functions 3 November 19th 04 06:05 AM


All times are GMT +1. The time now is 05:35 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"