This is an old thread from April 2013 and macro in now updated as it can not cope with a start date different from the 1st in a month.
Macro starts by checking if cell B2 (first date in the list) contains a date that corresponds to the first of the month. If not a row is inserted and formate from the inserted row is copied from the row below. Then EoMonth function is used to set the date for the 1st month. Then the last date in the B column is also set by using the same function if missing.
After that all dates between first and last date in that particular month are checked and if any is missing a new row is insert and the missing date added.
Option Explicit
Sub AddDate()
Dim i As Integer
Dim k As Integer
Dim cell As Range
If Right(Range("B2"), 2) = 1 Then
Else
Range("2:2").Insert CopyOrigin:=xlFormatFromRightOrBelow
Range("B2") = WorksheetFunction.EoMonth(Range("B3"), -1) + 1
End If
i = Range("B" & Rows.Count).End(xlUp).Row
If WorksheetFunction.EoMonth(Range("B2"), 0) = Cells(i, 2) Then
Else
Cells(i + 1, 2) = WorksheetFunction.EoMonth(Range("B2"), 0)
Cells(i, 2).Copy
Cells(i + 1, 2).PasteSpecial xlPasteFormats
End If
Range("A2:F" & i + 1).HorizontalAlignment = xlCenter
i = 2
For Each cell In Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row)
If cell.Value = WorksheetFunction.EoMonth(Range("B2"), 0) Then
GoTo stopper
End If
If cell.Value = cell.Offset(1, 0) - 1 Then
i = i + 1
Else
Rows(i + 1).EntireRow.Insert
cell.Offset(1, 0).Value = cell.Value + 1
End If
Next
stopper:
End Sub
In the original thread from the OP there should also be a numerical value added in columns A, C, D, E and F but this part of the macro is deleted as I assume they are of no interest.
Alf
Bookmarks