Code revised per your sample worbook with comments explaining. See attached.
I also added an optional line of code to convert the date formula into a static date. You can comment out or delete this bit of code if you want to retain the formula.
Option Explicit
Sub Insert_Column_Date()
Dim lcol As Long
'determine last used column using row4 (header row)
lcol = Cells(4, Columns.Count).End(xlToLeft).Column
'insert a new column beginning with last column
Cells(4, lcol).EntireColumn.Insert
'insert formula into header of new column and apply date format
Cells(4, lcol).FormulaR1C1 = "=EOMONTH(RC[-1],1)"
Cells(4, lcol).NumberFormat = "mmm-yy"
'optional code to convert formula to static value
Cells(4, lcol).Value = Cells(4, lcol).Value
End Sub
Bookmarks