Hey jindon,
I encountered a strange problem with Set c = rng2.Find(r.Value, , xlFormulas)
If r.value = 15/01/2016, it sets c = 15/11/2016 and thus starts copying the values for both 15/01/2016 and 15/11/2016.
E.g.
15/01/2016: it shows the 2 timestamps of 15/01/2016 and the 4 timestamps of 15/11/2016!
I highlighted some of these strange cases in red in wsSummary.
Would you mind having another look?
' Create the data for column C till last in wsSummary
' ---------------------------------------------------
Dim rng1 As Range, rng2 As Range, rng3 As Range, r As Range, c As Range, d As Range
Dim ff As String, gg As String
Set rng1 = wsSummary.Cells(1).CurrentRegion
Set rng2 = wsTime.Cells(1).CurrentRegion.Columns("f")
Set rng3 = wsPlanification.Cells(2).CurrentRegion.Columns("g")
rng1.Offset(1, 4).ClearContents
For Each r In rng1.Columns(1).Cells
If IsDate(r.Value) Then
Set c = rng2.Find(r.Value, , xlFormulas)
If Not c Is Nothing Then
ff = c.Address
Do
r(, 5) = r(, 5) + 1
'
' c(, 2).Copy r.Offset(, r(, 5) * 5)
' c(, 4).Copy r.Offset(, r(, 5) * 5 + 1)
' c(, 6).Copy r.Offset(, r(, 5) * 5 + 2)
' c(, 7).Copy r.Offset(, r(, 5) * 5 + 3)
' c(, 13).Copy r.Offset(, r(, 5) * 5 + 4)
Union(c(, 2), c(, 4), c(, 6), c(, 7), c(, 13)).Copy r.Offset(, r(, 5) * 5)
Set c = rng2.FindNext(c)
Loop Until c.Address = ff
Else
r(, 5) = 0
End If
End If
Next
SOLVED Set c = rng2.Find(r.Value, , xlFormulas, xlWhole)
Bookmarks