VBA Filtering/Shorting Assistance

bootj1234

Board Regular
Joined
Aug 27, 2012
Messages
85
I am looking for assistance with the following VBA code I have written to filter all data in my selected column to be applied to filter more than the single date that it’s giving.

Sub SortDataWithHeader()
ActiveSheet.Range("E1", Range("E1").End(xlDown)).AutoFilter Field:=5, Criteria1:=">=2019-06-17 10:00:00", _
Operator:=xlAnd, Criteria2:="<=2019-06-17 21:00:00"
End Sub

What I would like to achieve is to have the code loop through the data within my selected column, and based on the date portions of Criteria1 and Criteria2, apply the time portion of the Criteria1 and Criteria 2 to all the dates within the selected column.

Following is example of what I am trying to achieve:


[/IMG]
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

sijpie

Well-known Member
Joined
Nov 1, 2008
Messages
3,573
So what would the output look like?

Because the way I understand what you are saying is that
1)you want to after the filter is applied (which would only show the data for the 17th june) to
2)then additionally filter these to show only data with times either 10:00:00 or 21:00:00.

Which doesn't make sense to me.
 

Watch MrExcel Video

Forum statistics

Threads
1,090,550
Messages
5,415,223
Members
403,573
Latest member
ballardgirl

This Week's Hot Topics

Top