Currently I have the need to compare if a section in hours overlaps with another stretch of hours, the truth is that I'm getting a mess and I can not see what is not right, I attach what I have done to see if you see the error:
The stretches are HoraIni-HoraFin and stretchFrom-stretchTo
are whole numbers
a stretch for example from 1 to 3 and the other from 3 to 6 are not considered overlapping
If ((tramoDesde < HoraIni And HoraIni > tramoHasta) Or (tramoDesde < HoraFin And tramoHasta > HoraFin) Or (tramoDesde >= HoraIni And tramoHasta <= HoraFin)) Then
Solapados = True
End If
I imagine that in the end it will be a detail or something in the comparison