Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Mulitple Filter Selection

Hi,
I need to strenghten my code to allow the users to select 2 areas (or
columns) in which the filter would operate. I was able to do one, but can't
find a way to do more than one.

'
Dim Message, Title, MyValue
Dim ExactDate As Date
Dim ExactCriterion As String
Message = "Please Enter the Period, (00)"
Title = "Title"
MyValue = InputBox(Message, Title)

ExactCriterion = Format(ExactDate, "mm/dd/yy")

Range("Headers").AutoFilter
Range("Headers").AutoFilter Field:=6, Criteria1:=MyValue

Please help. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Mulitple Filter Selection

A sheet can only have one filter applied. If you want multiple areas, use multiple sheets, or
combine the ranges and use multiple criteria (on different columns)

HTH,
Bernie
MS Excel MVP


"MrRJ" wrote in message
...
Hi,
I need to strenghten my code to allow the users to select 2 areas (or
columns) in which the filter would operate. I was able to do one, but can't
find a way to do more than one.

'
Dim Message, Title, MyValue
Dim ExactDate As Date
Dim ExactCriterion As String
Message = "Please Enter the Period, (00)"
Title = "Title"
MyValue = InputBox(Message, Title)

ExactCriterion = Format(ExactDate, "mm/dd/yy")

Range("Headers").AutoFilter
Range("Headers").AutoFilter Field:=6, Criteria1:=MyValue

Please help. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Mulitple Filter Selection

Bernie,
If I understood you correctly, there is no way that I can ask the user to
provide filter criteria? I can build a macro for variable selected filters,
see below.
Selection.AutoFilter Field:=6, Criteria1:="13"
Selection.AutoFilter Field:=7, Criteria1:="08"
Selection.AutoFilter Field:=9, Criteria1:="Direct"
Selection.AutoFilter Field:=11, Criteria1:="PBGCAN"
Selection.AutoFilter Field:=20, Criteria1:="<NA", Operator:=xlAnd

With this concept, can I have the user be prompt to type in a value for 2
different columns?

Any ideas?

"Bernie Deitrick" wrote:

A sheet can only have one filter applied. If you want multiple areas, use multiple sheets, or
combine the ranges and use multiple criteria (on different columns)

HTH,
Bernie
MS Excel MVP


"MrRJ" wrote in message
...
Hi,
I need to strenghten my code to allow the users to select 2 areas (or
columns) in which the filter would operate. I was able to do one, but can't
find a way to do more than one.

'
Dim Message, Title, MyValue
Dim ExactDate As Date
Dim ExactCriterion As String
Message = "Please Enter the Period, (00)"
Title = "Title"
MyValue = InputBox(Message, Title)

ExactCriterion = Format(ExactDate, "mm/dd/yy")

Range("Headers").AutoFilter
Range("Headers").AutoFilter Field:=6, Criteria1:=MyValue

Please help. Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Mulitple Filter Selection

No. You can ask easily:

Selection.AutoFilter Field:=6, Criteria1:=CStr(InputBox("Criteria for Field 1"))
Selection.AutoFilter Field:=7, Criteria1:=CStr(InputBox("Criteria for Field 2"))

etc...


HTH,
Bernie
MS Excel MVP


"MrRJ" wrote in message
...
Bernie,
If I understood you correctly, there is no way that I can ask the user to
provide filter criteria? I can build a macro for variable selected filters,
see below.
Selection.AutoFilter Field:=6, Criteria1:="13"
Selection.AutoFilter Field:=7, Criteria1:="08"
Selection.AutoFilter Field:=9, Criteria1:="Direct"
Selection.AutoFilter Field:=11, Criteria1:="PBGCAN"
Selection.AutoFilter Field:=20, Criteria1:="<NA", Operator:=xlAnd

With this concept, can I have the user be prompt to type in a value for 2
different columns?

Any ideas?

"Bernie Deitrick" wrote:

A sheet can only have one filter applied. If you want multiple areas, use multiple sheets, or
combine the ranges and use multiple criteria (on different columns)

HTH,
Bernie
MS Excel MVP


"MrRJ" wrote in message
...
Hi,
I need to strenghten my code to allow the users to select 2 areas (or
columns) in which the filter would operate. I was able to do one, but can't
find a way to do more than one.

'
Dim Message, Title, MyValue
Dim ExactDate As Date
Dim ExactCriterion As String
Message = "Please Enter the Period, (00)"
Title = "Title"
MyValue = InputBox(Message, Title)

ExactCriterion = Format(ExactDate, "mm/dd/yy")

Range("Headers").AutoFilter
Range("Headers").AutoFilter Field:=6, Criteria1:=MyValue

Please help. Thanks.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Mulitple Filter Selection

Bernie,
Through some trial and error, I managed to pull it off. Here is the code I
used.
Dim Message, Title, MyValuePeriod
Dim ExactDate As Date
Message = "Please Enter the Period, (00)"
Title = "Title"
MyValuePeriod = InputBox(Message, Title)
Range("Headers").AutoFilter
Range("Headers").AutoFilter Field:=6, Criteria1:=MyValuePeriod


Message = "Please Enter the Year Reported, (00)"
Title = "Title"
MyValueYear = InputBox(Message, Title)
Range("Headers").AutoFilter Field:=7, Criteria1:=MyValueYear
End Sub

Thoughts?


"MrRJ" wrote:

Bernie,
If I understood you correctly, there is no way that I can ask the user to
provide filter criteria? I can build a macro for variable selected filters,
see below.
Selection.AutoFilter Field:=6, Criteria1:="13"
Selection.AutoFilter Field:=7, Criteria1:="08"
Selection.AutoFilter Field:=9, Criteria1:="Direct"
Selection.AutoFilter Field:=11, Criteria1:="PBGCAN"
Selection.AutoFilter Field:=20, Criteria1:="<NA", Operator:=xlAnd

With this concept, can I have the user be prompt to type in a value for 2
different columns?

Any ideas?

"Bernie Deitrick" wrote:

A sheet can only have one filter applied. If you want multiple areas, use multiple sheets, or
combine the ranges and use multiple criteria (on different columns)

HTH,
Bernie
MS Excel MVP


"MrRJ" wrote in message
...
Hi,
I need to strenghten my code to allow the users to select 2 areas (or
columns) in which the filter would operate. I was able to do one, but can't
find a way to do more than one.

'
Dim Message, Title, MyValue
Dim ExactDate As Date
Dim ExactCriterion As String
Message = "Please Enter the Period, (00)"
Title = "Title"
MyValue = InputBox(Message, Title)

ExactCriterion = Format(ExactDate, "mm/dd/yy")

Range("Headers").AutoFilter
Range("Headers").AutoFilter Field:=6, Criteria1:=MyValue

Please help. Thanks.




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
Default Filter Selection to None PJFry Excel Discussion (Misc queries) 0 December 3rd 08 05:13 PM
How do I filter or search mulitple for text strings? MikeD Excel Discussion (Misc queries) 2 October 29th 08 01:07 PM
Database - mulitple selection Christine[_3_] Excel Worksheet Functions 1 October 23rd 08 01:07 PM
Copy selected mulitple worksheets to mulitple new workbooks Ian Excel Programming 0 March 8th 07 08:12 PM
Copy selected mulitple worksheets to mulitple new workbooks Vergel Adriano Excel Programming 0 March 8th 07 06:57 PM


All times are GMT +1. The time now is 11:24 PM.

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"