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

Macro code to save sheet as a separate file to a specific location

Manny Singh

Member
Hi All,

Could you help writing a code for attached sheet to below requirement, much appreciated.

When I execute macro, it will save sheet "Comp Reg" as a separate file, file name to be same as cell M2 of sheet Comp Reg.

File location in the desktop ( I will update the location).

Thanks, Manny
 

Attachments

  • Weld Log - Copy.xlsm
    996.4 KB · Views: 1
More or less something like that:
Code:
Sub SaveSheet()
  Dim strPath  As String

  Application.ScreenUpdating = False
  Application.EnableEvents = False

  With Worksheets("Comp Reg")
  strPath = CreateObject("Wscript.Shell").SpecialFolders(4) & Application.PathSeparator & _
  .Range("M2").Value
  .Copy
  End With
  
  ActiveWorkbook.SaveAs strPath, xlOpenXMLWorkbook

  ActiveWorkbook.Close False
  Application.EnableEvents = True
End Sub
Artik
 
Back
Top