PDA

View Full Version : Using Code to Build Filters



GoKats78
11-21-2008, 08:51 AM
I have a large spreadheet that needs to be filtered (due to the nature it is easier to use code than AutoFilter).

I have the filter built - the user selects the filter they want to apply from a dropdown. That all works...What I need to figure out is how to apply a "default filter" when the user selects to dropdown l(ocated at D8) and deletes the value (e.g. the filter applied is "Hide Void" - if the user moves to D8 and hits delete).

Here is what I have...but the "Case Else" is not working when the values are deleted...




Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 4 Then
Select Case Target.Value
Case "Hide Pre 2008": Call Show2008On
Case "Show Pre 2008": Call ShowAll5
Case "Show In Audit": Call In_Audit
Case "Hide Void": Call HideVoid3
Case "Show 2008 On": Call Show_all
Case "Show All": Call ShowAll5
Case "Show Void": Call ShowVoid3
Case "Show Open": Call ShowOpen3
Case "Show Awaiting Internal Review": Call ShowIntReview
Case Else: Call Show2008On
End Select
End If

Bob Phillips
11-21-2008, 08:56 AM
Sorry, didn't get that.

Can you post a workbbok, and talk us through what to do, what does happen, what should happen.

GoKats78
11-21-2008, 11:54 AM
I will try....but be gentle...this is my first attempt at using code to do much of anything...so there is some ugly stuff in there...

What I want the default filter to do (or when the user does what I said above) is return all data from 2008 on (starts at row 491).