tammyl
12-29-2009, 11:39 PM
Hi,
I'm trying to create a new worksheet for every week within a date range.
I've been trying to get a 'for each, next' loop to step by 7 days but can't seem to get it to work.
Date range in column A. Eg: 1/1/2010 - 31/12/2010 (range also used for other code.
I then select a start date & end date range to create the weekly spreadsheets for a few months at a time.
So far i'm reading the date and trying to do a step + 7 but this isn't working because my vba code is reading every record in the range.
Eg: First wsheet trigger date 1/1/2010, second wsheet trigger date +7 days = 8/1/2010
Current code as below
r = 1
For Each Row In rng
If Row.Value >= Sdate And Row.Value <= Edate Then
Set wksNew = Worksheets("Weekly").Copy(After:=Worksheets(Worksheets.Count))
End If
r = r + 7
Next
Hope somebody can assist.
Cheers
tammyl
I'm trying to create a new worksheet for every week within a date range.
I've been trying to get a 'for each, next' loop to step by 7 days but can't seem to get it to work.
Date range in column A. Eg: 1/1/2010 - 31/12/2010 (range also used for other code.
I then select a start date & end date range to create the weekly spreadsheets for a few months at a time.
So far i'm reading the date and trying to do a step + 7 but this isn't working because my vba code is reading every record in the range.
Eg: First wsheet trigger date 1/1/2010, second wsheet trigger date +7 days = 8/1/2010
Current code as below
r = 1
For Each Row In rng
If Row.Value >= Sdate And Row.Value <= Edate Then
Set wksNew = Worksheets("Weekly").Copy(After:=Worksheets(Worksheets.Count))
End If
r = r + 7
Next
Hope somebody can assist.
Cheers
tammyl