Thanks; I see where I got it wrong! For good measure; here is the final and working code:
Sub test()
Dim cDummy As Range
Dim rvDummy As Date
Dim cvDummy As String
Dim c1Historik As Range
Dim c2Historik As Date
For Each cDummy In Range("rDummy")
On Error Resume Next
rvDummy = cDummy.End(xlToLeft).Value
cvDummy = cDummy.End(xlUp).Value
For Each c1Historik In Range("Historik_start")
c2Historik = c1Historik.Offset(0, 1).Value
If c1Historik.Offset(0, -1).Value = cvDummy Then
If DateValue(c1Historik.Value) <= DateValue(rvDummy) And DateValue(c2Historik) >= DateValue(rvDummy) Then
cDummy = 3
End If
End If
Next c1Historik
On Error GoTo 0
Next cDummy
End Sub
Bookmarks