Hi
I have two columns of numbers as shown. In cells B1 to B10, there are numbers representing hours, minutes, seconds and milliseconds.
A B
1 00:00:01.640
2 00:00:03.718
3 00:00:05.796
4 00:00:07.875
5 00:00:09.953
6 00:00:12.031
7 00:00:14.109
8 00:00:16.140
9 00:00:18.156
10 00:00:20.234
I have a userform where I want to input a start_time (say 00:00:05) and end time (say 00:00:16) and I need to search the 10 numbers to find the subset start and end cell. In other words, I want to be able to see that the cells I am interested in are from B3 to B8.
I have created a for loop which looks at each B cell and compares with a starttime as shown, however, I cannot seem to get the datatyes right for this to work. The datatype of the values in the B cells is 'number'. I have tried making the starttime datatime integer, number and even string and getting nowhere.
For looper = 1 To 10
If Range("B" & looper).Value < starttime Then
count = count + 1
End If
Next looper
Can anyone point me in the right direction?
Martin
Bookmarks