• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Save Spreadsheets as Separate File with Name and Given Date

kundanlal

Member
Hello Every One..

Need one help..

Enclosed please find a Sample file with some data.

I need to Save Each Sheet as a Seperate File (with what ever data available in respective sheets) with Same Name as that of Sheet.

Also need to add some Text and date alongwith file name(if vba can as Text and date to enter, it is appreciated".

i.e. in this case.. The files to be created as

Delhi-Ppt Data-17-10-2019.xls
Surat-Ppt Data-17-10-2019.xls
Pune-Ppt Data-17-10-2019.xls

Is it possible..

Thanks and Regards,

Kundanlal
 

Attachments

  • Sample data to Save each sheet as file.xls
    19.5 KB · Views: 6
See next code
Code:
Option Explicit

Sub Treat()
Dim WkPath As String
Dim Ws  As Worksheet
Dim WkDate As String

    WkPath = ActiveWorkbook.Path
    WkDate = Format(Now(), "dd-mm-yyyy")
    For Each Ws In Sheets
        Workbooks.Add

        Ws.UsedRange.Copy Destination:=Cells(1, 1)
        ActiveWorkbook.SaveAs WkPath & "\" & Ws.Name & "-Ppt Data " & WkDate
        ActiveWorkbook.Close
    Next Ws
End Sub
 
Back
Top