View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Incrementally Updating worksheets in a workbook

You could insert a formula into B2 on each sheet so it increments the
date entered in Sheet1 respectively. The formula for Sheet2!$B$2 is:

=DATE(YEAR(Sheet1!$B2),MONTH(Sheet1!$B2)+1,DAY(She et1!$B2))
To insert this on the other 10 sheets you must increment the counter in
the 'Month' part of the formula only. (The year will increment
automatically)

----------------------------------------------------------------
To insert this formula appropriately for all 11 sheets via code:
----------------------------------------------------------------

Sub IncrementMonths()
Dim i As Integer
For i = 2 To 12
Sheets(i).Range("$B$2").Formula = _
"=DATE(YEAR(Sheet1!$B2),MONTH(Sheet1!$B2)+" _
& i - 1 & ",DAY(Sheet1!$B2))"
Next
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc