Okay, so this one is stumping me and I can't seem to find what I need through Search.
I have a worksheet where users input times in the format of:
"8:30-17:00" (All times are military)
I then need to have VBA take that entry, and find out how many hours have elapsed. All times will be in 15 min increments, so I'd like to get number of hours (ie: 3.25 or 8.5, etc)
I've used the following code to get the start and end times, but they don't appear to be in a format where I can subtract.
Any help would be GREATLY appreciated!
I have a worksheet where users input times in the format of:
"8:30-17:00" (All times are military)
I then need to have VBA take that entry, and find out how many hours have elapsed. All times will be in 15 min increments, so I'd like to get number of hours (ie: 3.25 or 8.5, etc)
I've used the following code to get the start and end times, but they don't appear to be in a format where I can subtract.
Any help would be GREATLY appreciated!
Code:
For t = 3 to 416 step 7
StartTime = Left(Worksheets("Training Schedule").Range("d" & t + 4).Value, _
InStr(1, Worksheets("Training Schedule").Range("d" & t + 4).Value, "-", vbTextCompare) - 1)
EndTime = Right(Worksheets("Training Schedule").Range("d" & t + 4).Value, _
Len(Worksheets("Training Schedule").Range("d" & t + 4).Value) - _
InStr(1, Worksheets("Training Schedule").Range("d" & t + 4).Value, "-", vbTextCompare))
Next t