Save Sheets In Different Files

  • Thread starter Thread starter Faraz A. Qureshi
  • Start date Start date
F

Faraz A. Qureshi

Dear felows,

Need your expertise in having a weekly database file with 52 sheets be saved
into different files with names as displayed in a specific cell. For instance
every sheet has a date in its respective cell C1 as a date, like 1/1/09,
1/8/09, 1/15/09 etc. I want them to be saved in different files each with
names like 2009-1-1, 2009-1-8, 2009-1-15 etc. i.e. date in C1 as the filename
in the format yyyy-m-d, in a specific folder like D:\NewFolder\

Thanx in advance friends.
 
Hi Faraz

If all the sheets cell c1 has a valid **unique** date the below should do
with out any errors..

Sub Macro()
Dim wb As Workbook
Dim strFolder As String
Set wb = ActiveWorkbook
strFolder = "D:\NewFolder\"
Application.ScreenUpdating = False
For Each shTemp In wb.Sheets
shTemp.Copy
ActiveWorkbook.SaveAs strFolder & Format(Range("c1"), "yyyy-m-d")
ActiveWorkbook.Close True
Next
Application.ScreenUpdating = True
End Sub

If this post helps click Yes
 
Back
Top