Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If/Elseif AutoFilter Macro
SETUP. I have a column with many different job names repeated in it and
AutoFilter has been applied to it. I also have setup a drop down list that puts a selected job name into helper cell Q4. In the drop down list I also have the word 'All'. MACRO. I need a macro that does not trigger the filter if cell Q4 equals 'All', but filters the indicated job name if not equal to 'All'. Below is what I have so far. I can't figure out the code that should go after the first 'Then'. Also not sure if rest of macro is correct. BIG PICTURE. Ultimately, I want to use this code sequence three times to filter three different columns with one macro. Each will have it's own drop down list and helper cell with 'All' or names in them to direct the filter. Your help would be greatly appreciated. Sub FilterData_JobName() Application.ScreenUpdating = False 'Run (Select All) Filter before running specific filter ActiveSheet.Range("$B$8:$T$453").AutoFilter Field:=4 'Filter Col-E [Field:=4] (Job Name) Ref. cell Q4 Sheets("Time Sheet").Select With Sheets("Time Sheet") If Sheets("Time Sheet").Range("Q4").Value = "All" Then '--???? need code that ends this part of macro here ????-- ElseIf Sheets("Time Sheet").Range("Q4").Value < "All" Then ActiveSheet.Range("$B$8:$T$453").AutoFilter Field:=4, Criteria1:=ActiveSheet.Range("Q4").Value, _ Operator:=xlOr, VisibleDropDown:=True End With Application.ScreenUpdating = False End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
elseif | Excel Programming | |||
elseif | Excel Programming | |||
elseif | Excel Programming | |||
IF..Then..ELSE.. ELSEIF | Excel Programming | |||
ElseIf | Excel Programming |