Try this
Code:
Sub Consolidator()
Dim varInput, varOutput As Variant
Dim lngMinYear As Long, lngMaxYear As Long, lngLoop As Long, lngRow As Long, lngCol As Long
With Application
varInput = .Transpose(Worksheets(1).Cells(1).CurrentRegion.Offset(1).Columns(1).Resize(, 2).Cells.Value2)
lngMinYear = Year(.Min(.Index(varInput, 1)))
lngMaxYear = Year(.Max(.Index(varInput, 1)))
End With
ReDim varOutput(1 To (lngMaxYear - lngMinYear) + 2, 1 To 367)
For lngLoop = 2 To UBound(varOutput)
varOutput(lngLoop, 1) = lngMinYear + (lngLoop - 2)
Next lngLoop
For lngLoop = 2 To 367
varOutput(1, lngLoop) = Format(lngLoop + 365 * 4, "D.M.")
Next lngLoop
For lngLoop = LBound(varInput, 2) To UBound(varInput, 2)
If Not IsEmpty(varInput(1, lngLoop)) Then
If IsNumeric(varInput(1, lngLoop)) Then
With Application
lngRow = .Match(Year(varInput(1, lngLoop)), .Index(varOutput, , 1), 0)
lngCol = .Match(Format(varInput(1, lngLoop), "D.M."), .Index(varOutput, 1), 0)
varOutput(lngRow, lngCol) = varInput(2, lngLoop)
End With
End If
End If
Next lngLoop
With Worksheets(2)
.UsedRange.Clear
.Cells(1).Resize(UBound(varOutput, 1), UBound(varOutput, 2)).Value = varOutput
End With
End Sub
Bookmarks