Good morning!
I have a macro that allows the user to AutoFilter by Name, Start Date and End Date.
I have it working; however, now I need it to be able to provide everyone in the list in the criteria, but still filter between start and end date.
Here is the code I'm using:
In short, I'd like to let the user to be able to select "ALL" in cell G3 (in the worksheet) and if "ALL" defer to only the start and end date.
ANY HELP WOULD BE GREATLY APPRECIATED!
Thanks,
Phil
I have a macro that allows the user to AutoFilter by Name, Start Date and End Date.
I have it working; however, now I need it to be able to provide everyone in the list in the criteria, but still filter between start and end date.
Here is the code I'm using:
PHP:
Sub Filter()
Dim DateStart As Date
Dim DateEnd As Date
Dim Name As String
DateStart = [H3].Value
DateEnd = [I3].Value
Name = [G3].Value
' Set the filter
Range("A5:IV5").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=Name
Selection.AutoFilter Field:=21, Criteria1:= _
">=" & DateStart, Operator:=xlAnd, Criteria2:="<=" & DateEnd
Range("U5").Select
End Sub
In short, I'd like to let the user to be able to select "ALL" in cell G3 (in the worksheet) and if "ALL" defer to only the start and end date.
ANY HELP WOULD BE GREATLY APPRECIATED!
Thanks,
Phil