browncountry
New Member
- Joined
- Feb 2, 2019
- Messages
- 13
F | G | |
1 | DATE | TIME |
2 | 2/19/2019 | 18:00 |
3 | 2/19/2019 | 23:20 |
4 | 2/19/2019 | 3:30 |
5 | 2/20/2019 | 6:30 |
6 | 2/20/2019 | 7:00 |
7 | 2/20/2019 | 8:00 |
<tbody>
</tbody>
I'm having trouble deleting rows based on date & time. I have a report that exports transaction dates and times in Columns F & G respectively. Time exports as a text field. The idea is to delete rows from the earlier (MIN) date that are less than Time Value 20:00 and all rows from the latter date (MAX) greater than Tim Value 6:30.
I am able to create formulas to mark these rows, but I just don't know how to translate that to VBA code.
These are formulas I created to mark rows to KEEP.
=IF(AND(F2=MIN(F:F),TIMEVALUE(G2)>TIMEVALUE("20:00")),"x","")
=IF(AND(F2=MAX(F:F),TIMEVALUE(G2)<timevalue("6:30")),"x","")
In my example, Rows 3-5 would not be deleted. This comes from and 3rd shift production report so dates vary. That's why I figured MIN and MAX functions could be incorporated. Please help. Thanks!</timevalue("6:30")),"x","")