Try this macro
Sub Test()
For N = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If (Month(Cells(N, 1)) - 1 = Month(Cells(N - 1, 1)) And Year(Cells(N, 1)) = Year(Cells(N - 1, 1))) Then
ElseIf (Month(Cells(N, 1)) = 1 And Year(Cells(N, 1)) - 1 = Year(Cells(N - 1, 1))) Then
Rows(N).Insert
Cells(N, 1) = DateValue(12 & "/" & Year(Cells(N - 1, 1)))
Cells(N, 2) = Cells(N - 1, 2)
N = N + 1
Else
Rows(N).Insert
Cells(N, 1) = DateValue(Month(Cells(N + 1, 1) - 1) & "/" & Year(Cells(N + 1, 1)))
Cells(N, 2) = Cells(N - 1, 2)
N = N + 1
End If
Next N
End Sub
Open up the VBA editor by hitting ALT F11
Insert a new module by hitting Insert - Module
Paste the macro into the empty sheet
Hit ALT F11 to get back to the worksheet.
Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007.
Bookmarks