I think is an easy one (not for a excel VBA dummy like me...) I'm trying to find a date (hour format) (writen in another cell C5) inside a range of dates. The code is the following one, but I receive nothing as an output, and I do not understand why... Thank you in advance for your help...
Sub recorrer()
Dim rng As Range, cell As Range
Sheets("General").Activate
Set rng = Range("A22", Range("A22").End(xlDown))
For Each cell In rng
If DateDiff("h", Sheets("Hoja1").Range("C5").Value, cell.Value) < 0 Then
cell = Sheets("Hoja1").Range("C2").Value
End If
Exit For
Next
End Sub