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:


21m9nhs.jpg
[/IMG]
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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.
 
Upvote 0

Forum statistics

Threads
1,214,566
Messages
6,120,257
Members
448,952
Latest member
kjurney

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top