PDA

View Full Version : Copy Multiple sheet as SaveAs



Panir Selvam
06-01-2016, 03:02 AM
Hi All,

I am new in VBA Express forum.
I am stuck with one code. The whole idea is to create a working template. Upon completed a button click will SaveAs the file to the desire location.

With current code, it only able to copy and save the active sheet and rest can't. Hope you guys can help me.

This is the code


Sub SaveInvWithNewName()
Dim NewFN As Variant

ActiveSheet.Copy
NewFN = "D:\kashwin\SDMI-16-DO_" & Range("G13").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close

End Sub

Thanks

Edit by Moderator: Moved from Testing sandbox to Excel Forum.

mdmackillop
06-02-2016, 11:18 AM
Welcome to VBAX

Sub Test3()
NewFN = "D:\kashwin\SDMI-16-DO_" & Range("G13").Value & ".xlsx"

Sheets(Array("Sheet1", "Sheet2", "Sheet4")).Copy
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
ActiveWorkbook.Close
End Sub