Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Selection.AutoFilter Field represented by "all"

In a Selection.AutoFilter Field is there a way to have Criteria1 represent
"all"?

For example,

Selection.AutoFilter Field:=4

alone will represent "all"

and

Selection.AutoFilter Field:=4, Criteria1:=Price

will select based on the price.

I have set up a Userform so that "all" could be represented by "0" in the
string variable Price. But I would preferred to have it represented by "all" in
some form when the textbox is left blank.

I could figure out some code that the ", Criteria1:=Price" is added after
Selection.AutoFilter Field is added but that seems to be going overboard.

Thanks,
Jeff



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Selection.AutoFilter Field represented by "all"

Jeff,

This seems to work fine:

If Price = "0" Or Price = "" Then
Selection.AutoFilter Field:=4
Else
Selection.AutoFilter Field:=4, Criteria1:=Price
End IF

HTH,
Bernie
Excel MVP


"JeffFinnan" wrote in message ...
In a Selection.AutoFilter Field is there a way to have Criteria1 represent
"all"?

For example,

Selection.AutoFilter Field:=4

alone will represent "all"

and

Selection.AutoFilter Field:=4, Criteria1:=Price

will select based on the price.

I have set up a Userform so that "all" could be represented by "0" in the
string variable Price. But I would preferred to have it represented by "all" in
some form when the textbox is left blank.

I could figure out some code that the ", Criteria1:=Price" is added after
Selection.AutoFilter Field is added but that seems to be going overboard.

Thanks,
Jeff





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Selection.AutoFilter Field represented by "all"

Bernie,

Yeah, I guess I will have to resort to this type of conditional phrasing. I was
hoping that there might be some simpler trick.

Thanks,
Jeff

If Price = "0" Or Price = "" Then
Selection.AutoFilter Field:=4
Else
Selection.AutoFilter Field:=4, Criteria1:=Price
End IF



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
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 16th 08 09:23 PM
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 15th 08 07:26 PM
Pivot Tables - How can I "reset" the selections in "Row Field"? shadestreet Excel Discussion (Misc queries) 3 April 24th 06 06:29 PM
what does the symbol "^" mean and how can it be represented in a f Chad Excel Worksheet Functions 4 January 15th 06 07:44 PM
Icon for "Wrap" and for "Centre Across Selection" BeSmart Excel Worksheet Functions 2 November 16th 05 06:44 PM


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