Belleke
Well-Known Member
For some reason that I can't find out.
With this code the first 3 rows have the US date format, the rest is correct.
Please advice
With this code the first 3 rows have the US date format, the rest is correct.
Code:
Sub Dotchie()
Dim Rng As Range, Dn As Range
Dim St As Date, oEnd As Date, n As Date
Dim p As Long
Dim c As Integer
p = 1
Set Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
St = Application.Min(Rng.Offset(, 1).Resize(, 2))
oEnd = Application.Max(Rng.Offset(, 1).Resize(, 2))
ReDim Ray(1 To oEnd - St + 2, 1 To 2)
Ray(1, 1) = "Datum": Ray(1, 2) = "Bedden in gebruik"
For n = St To oEnd
p = p + 1
For Each Dn In Rng
If n >= Dn.Offset(, 1) And n <= Dn.Offset(, 2) Then
c = c + 1
End If
Next Dn
Ray(p, 1) = Format(n, "dd/mm/yyyy"): Ray(p, 2) = c
c = 0
Next n
Range("D1").Resize(p, 2) = Ray
End Sub
Please advice