LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
elseif Curt Excel Programming 0 March 28th 07 03:06 AM
elseif Tom Ogilvy Excel Programming 3 March 28th 07 03:03 AM
elseif Curt Excel Programming 0 March 28th 07 01:13 AM
IF..Then..ELSE.. ELSEIF ole_ Excel Programming 4 April 20th 05 03:59 PM
ElseIf tom1646 Excel Programming 4 October 19th 04 02:09 PM


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