I have a list (List A) of exact moment of an occurrence (Date an Time) exel format. I have another list with Beginning dates and End Dates of a time lapse (List B). I want to know, flag those events in list A that happened within any of the ranges of List B (and put their position or identifier). Ive tried using date and datevalues to compare , defining as long, double as date but it seems to fail, and im stuck. pls help cannu spot the mistake?
this is te code i wrote:
Dim i As Integer
Dim j As Integer
Dim TrDATE As Date ' Travel Date variable
Dim BegDate As Date ' Begining Date variable
Dim EndDate As Date ' Ending Date variable
Dim nRides As Integer ' Number of Rides
Dim nMDX As Integer 'n number of Tolls from MDX
Dim nFDOT As Integer 'n number of Tolls from FDOT
nRides = 1910
nMDX = 315
nFDOT = 191
i = 2
Sheets("mdx").Select
While i < nMDX
j = 2
Sheets("mdx").Select
TrDATE = Cells(i, "D")
While j < nRides
Sheets("uber").Select
BegDate = Cells(j, "R")
EndDate = Cells(j, "S")
If (BegDate < TrDATE) And (TrDATE < EndDate) Then
Sheets("mdx").Select
Cells(i, "S") = 1
Cells(i, "R") = i
Cells(i, "Q") = j
j = 2000
Else
Sheets("mdx").Select
Cells(i, "S") = 0
Cells(i, "R") = i
Cells(i, "Q") = j
j = j + 1
End If
Wend
i = i + 1
Wend
Bookmarks