i want to add the column after ending of every month, how to write the vba code for this??? i have dates in the column , not all dates of the months are present.
Before running the macro below, select the dates, a single row with dates in every cell. This selection is what the macro will look at.
Make sure when you run it that the active sheet is the one you want to add columns to.
Code:
Sub blah()
Set Rng = Selection
For c = Rng.Columns.Count To 2 Step -1
Rng.Cells(c).Select
If Application.EoMonth(Rng.Cells(c).Value, 0) <> Application.EoMonth(Rng.Cells(c - 1).Value, 0) Then
Rng.Cells(c).EntireColumn.Insert
End If
Next c
End Sub