• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

adding column


New Member
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.



Well-Known Member
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.
Sub blah()
Set Rng = Selection
For c = Rng.Columns.Count To 2 Step -1
  If Application.EoMonth(Rng.Cells(c).Value, 0) <> Application.EoMonth(Rng.Cells(c - 1).Value, 0) Then
  End If
Next c
End Sub