Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Dylan Bouchard   on Dec 28 In MS Office Category.

  
Question Answered By: Sairah Hashmi   on Dec 28

Try the macro  below. It will not change your formulae that
referencing cells containing dates and it will not change your date
formats.

Sub Macro1()
'
' Macro to increment all dates in a spread sheet by one month.
'
Dim OldDate As Date
RowNo = Cells.SpecialCells(xlCellTypeLastCell).Row
ColNo = Cells.SpecialCells(xlCellTypeLastCell).Column

For i = 1 To RowNo Step 1
For j = 1 To ColNo Step 1
If Cells(i, j).HasFormula = False Then
If IsDate(Cells(i, j).Value) Then
OldDate = Cells(i, j).Value
Cells(i, j).Value = DateAdd("m", 1, OldDate)
End If
End If
Next j
Next i
End Sub

Share: 

 

This Question has 8 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on advancing date macro Or get search suggestion and latest updates.


Tagged: