need help subtracting time stamps between two cells and highlighting if value lies within certain ranges

Johnmcgreevy

New Member
Joined
Sep 10, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
It has been a long time since I tried to work with excel macros/vba. . . the report I receive populates time in a "general" format. I need to compare "B"&count with "B"&count+1. If the difference is less than 10 minutes, 'Next', if between 10.01 and 15, highlight row yellow, if greater than 15.01 then highlight row red. . .I'm not sure why I can't figure this out, cause I know I've done it before... it's just been a decade and a half, so there are some new commands I'm not familiar with. If this is something you can help with, I can upload an image of the spreadsheet and the code I'm 'ruining :)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Scanner ID:1911-23890From:9/2/2020 11:06:25 PM
Total:80To:9/3/2020 6:27:10 AM
DateTimeChip IDChips TypeDescription
9/2/202011:06:25 PM002E0059D0E9CheckpointBedroom3
9/2/202011:06:37 PM002E005A088ECheckpointBedroom4
9/2/202011:10:31 PM002E0059D0E9CheckpointBedroom3
9/2/202011:10:38 PM002E005A088ECheckpointBedroom4
9/2/202011:21:10 PM002E0059D0E9CheckpointBedroom3
9/2/202011:21:17 PM002E005A088ECheckpointBedroom4
9/2/202011:29:21 PM002E005A088ECheckpointBedroom4
9/2/202011:29:32 PM002E0059D0E9CheckpointBedroom3
9/2/202011:44:22 PM002E0059D0E9CheckpointBedroom3
9/2/202011:44:30 PM002E005A088ECheckpointBedroom4
9/2/202011:51:41 PM002E0059D0E9CheckpointBedroom3
9/2/202011:51:48 PM002E005A088ECheckpointBedroom4
9/3/202012:03:21 AM002E005A088ECheckpointBedroom4
9/3/202012:03:32 AM002E0059D0E9CheckpointBedroom3
9/3/202012:11:01 AM002E0059D0E9CheckpointBedroom3
9/3/202012:11:13 AM002E005A088ECheckpointBedroom4
9/3/202012:24:51 AM002E0059D0E9CheckpointBedroom3
9/3/202012:25:00 AM002E005A088ECheckpointBedroom4
9/3/202012:29:44 AM002E005A088ECheckpointBedroom4
9/3/202012:29:52 AM002E0059D0E9CheckpointBedroom3
9/3/20201:39:10 AM002E0059D0E9CheckpointBedroom3
9/3/20201:39:22 AM002E005A088ECheckpointBedroom4
 
Upvote 0
For count1 = 3 To 100


Range("B3:B100").Select
Selection.NumberFormat = "h:mm:ss;@"


x = 3

y = Range("B" & x)



Do Until x = 70

If Range("B" & x + 1).Value = y Then

Range("B" & x).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[1]C[-1]-RC[-1]"


Else: y = Range("B" & x + 1)

End If

x = x + 1
Loop

Next
x = 3

For x = 3 To 70

If Range("B" & x).Value2 <= 0.00695 Then


Range("A" & x, Range("A" & x).End(xlToRight)).Select

With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 16777215
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If

If Range("B" & x).Value >= 0.0069500001 And _
Range("B" & x).Value <= 0.0104282 Then _


Range("A" & x, Range("A" & x).End(xlToRight)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If

If Range("B" & x).Value2 >= 0.010428200001 Then


Range("A" & x, Range("A" & x).End(xlToRight)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End If

If Range("A" & x + 1).Value = Empty Then GoTo Here:

Next


Here:
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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