Public Sub Reformat
Dim this As Worksheet
Dim ws As Worksheet
Dim lastrow As Long
Dim nextrow As Long
Dim matchrow As Long
Dim i As Long
Set this = ActiveSheet
Set ws = Worksheets.Add(after:=Worksheets(Worksheets.Count))
With ws
.Range("B1").Value = "Year"
.Range("A2:N2").Value = Array("Products", "Month", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
.Range("C1").Value = "2014"
.Range("C1:N1").HorizontalAlignment = xlCenterAcrossSelection
.Columns("B:B").ColumnWidth = 5.29
.Columns("C:N").ColumnWidth = 4
.Range("B1:N2").Font.Bold = True
With .Range("A2:N2").Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
With .Range("C1:N1").Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.499984740745262
.PatternTintAndShade = 0
End With
.Range("A3").Interior.ColorIndex = 6
End With
With this
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
nextrow = 2
For i = 2 To lastrow
matchrow = 0
On Error Resume Next
matchrow = Application.Match(.Cells(i, "A").Value, ws.Columns(1), 0)
On Error GoTo 0
If matchrow = 0 Then
nextrow = nextrow + 1
matchrow = nextrow
ws.Cells(matchrow, "A").Value = .Cells(i, "A").Value
End If
ws.Cells(matchrow, Month(.Cells(i, "B").Value) + 2).Value = .Cells(i, "C").Value
Next i
End With
ws.Range("A3").Copy
ws.Range("A4").Resize(nextrow - 3).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
End Sub