View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Split Monthly Forecast into Weekly Buckets

oops, i forgot the first date
the result is put in cells A3:C12

Sub Macro1()
Dim i As Long, y As Integer, x As Integer
For i = 1 To 3 'range A1, B1, C1
For y = 1 To 10 Step 2 '5 weeks max per month
If Cells(1, i) + (7 * a) < Cells(1, i + 1) Then
Cells(y + 2, i) = Cells(1, i) + (7 * a)
a = a + 1
If Cells(1, i + 1) = 0 Then
Cells(y + 3, i) = Cells(2, i) / 5
Else
x = (((Cells(1, i + 1) - Cells(1, i)) / 7))
Cells(y + 3, i) = Cells(2, i) / x
End If
Else
Exit For
End If
Next
a = 0
Next
End Sub


isabelle