Option Explicit
Sub Pivotingableing()
' constants
Const ksSourceWS = "Unpivotable table"
Const ksTargetWS = "Hoja1"
' declarations
Dim rngS As Range, rngT As Range
Dim I As Integer, J As Integer, K As Integer
' start
Set rngS = Worksheets(ksSourceWS).Cells
Set rngT = Worksheets(ksTargetWS).Cells
rngT.ClearContents
' process
' titles
I = 1
With rngT
.Cells(I, 1).Value = "Period"
.Cells(I, 2).Value = "Blumberg ticker"
.Cells(I, 3).Value = "Value"
End With
With rngS
For J = 1 To .Columns.Count Step 3
If .Cells(1, J).Value = "" Then Exit For
I = I + 1
If .Cells(3, J).Value <> "" And .Cells(3, J + 1).Value <> "" Then
K = .Cells(3, J).End(xlDown).Row - 3 + 1
Range(.Cells(3, J), .Cells(3, J).End(xlDown)).Copy rngT.Cells(I, 1)
Range(rngT.Cells(I, 2), rngT.Cells(I + K - 1, 2)).Value = .Cells(1, J).Value
Range(.Cells(3, J + 1), .Cells(3, J + 1).End(xlDown)).Copy rngT.Cells(I, 3)
Else
K = 0
End If
I = I + K - 1
Next J
End With
' end
Set rngT = Nothing
Set rngS = Nothing
' beep
Beep
End Sub