View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bobby Bobby is offline
external usenet poster
 
Posts: 75
Default Block saving using dates

Thanks a lot guys this has helped me out no end, thanks again.

"Dave Peterson" wrote:

Option Explicit
Sub testme()

Dim iCtr As Long
Dim FirstDate As Date

FirstDate = DateSerial(2004, 10, 16)
'or for today's date
FirstDate = Date

For iCtr = FirstDate To FirstDate + 6 '7 times
ActiveWorkbook.SaveCopyAs Filename:=ActiveWorkbook.Path & "\" _
& Format(iCtr, "dd mmm yy") & ".xls"
Next iCtr

End Sub

It uses the active workbook's path for the folder name.

And I like a format of:
& Format(iCtr, "yyyy_mm_dd") & ".xls"

Easier to sort on in windows explorer.

Bobby wrote:

I'm trying to make a macro that will save a workbook to 7 files, example, it
saves as 17 oct 04
18 oct 04
19 oct 04
and so on, so with one click i can create the next 7 days workbooks.
if someone can help it would be great.
Thankyou


--

Dave Peterson