browncountry
New Member
- Joined
- Feb 2, 2019
- Messages
- 13
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]F
[/TD]
[TD="align: center"]G
[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]DATE
[/TD]
[TD="align: center"]TIME
[/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD="align: center"]2/19/2019
[/TD]
[TD="align: center"]18:00
[/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD="align: center"]2/19/2019
[/TD]
[TD="align: center"]23:20
[/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]2/19/2019
[/TD]
[TD="align: center"]3:30
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]2/20/2019
[/TD]
[TD="align: center"]6:30
[/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]2/20/2019
[/TD]
[TD="align: center"]7:00
[/TD]
[/TR]
[TR]
[TD="align: center"]7
[/TD]
[TD="align: center"]2/20/2019
[/TD]
[TD="align: center"]8:00
[/TD]
[/TR]
</tbody>[/TABLE]
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","")
<tbody>[TR]
[TD][/TD]
[TD="align: center"]F
[/TD]
[TD="align: center"]G
[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]DATE
[/TD]
[TD="align: center"]TIME
[/TD]
[/TR]
[TR]
[TD="align: center"]2
[/TD]
[TD="align: center"]2/19/2019
[/TD]
[TD="align: center"]18:00
[/TD]
[/TR]
[TR]
[TD="align: center"]3
[/TD]
[TD="align: center"]2/19/2019
[/TD]
[TD="align: center"]23:20
[/TD]
[/TR]
[TR]
[TD="align: center"]4
[/TD]
[TD="align: center"]2/19/2019
[/TD]
[TD="align: center"]3:30
[/TD]
[/TR]
[TR]
[TD="align: center"]5
[/TD]
[TD="align: center"]2/20/2019
[/TD]
[TD="align: center"]6:30
[/TD]
[/TR]
[TR]
[TD="align: center"]6
[/TD]
[TD="align: center"]2/20/2019
[/TD]
[TD="align: center"]7:00
[/TD]
[/TR]
[TR]
[TD="align: center"]7
[/TD]
[TD="align: center"]2/20/2019
[/TD]
[TD="align: center"]8:00
[/TD]
[/TR]
</tbody>[/TABLE]
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","")