• 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.

Copy and saving tab on file location

Hi,

Can anyone help me with VBA that create a copy of particular tab (For example JE) and save it on file location (with paste special values in case of formulas). The name of the file should be value that is in cell C3.
 

Attachments

  • JE Template - Copy.xlsm
    104.7 KB · Views: 3
I guess you wanted xlsm file type?

Code:
Sub CopySheetToNewWorkbook()
  Dim wb As Workbook
  Set wb = Workbooks.Add(xlWBATWorksheet)
  ThisWorkbook.Worksheets("JE").Copy After:=wb.Worksheets(1)
  Application.DisplayAlerts = False
  wb.Worksheets(1).Delete
  wb.SaveAs ThisWorkbook.Path & "\" & _
    ThisWorkbook.Worksheets("JE").Range("C3").Value & ".xlsm", _
    xlOpenXMLWorkbookMacroEnabled 'xlOpenXMLWorkbook
  wb.Close False
  Application.DisplayAlerts = True
End Sub
 
Back
Top