PDA

View Full Version : [SOLVED] Copy certain worksheets from one workbook to another while keeping format



podder
01-14-2018, 04:32 PM
Hi,
Could anybody please help, I have a workbook that generates invoices through a macro and I need these generated invoices to be copied and saved to a new workbook.
I would like the formatting to remain and a msgbox to let me rename the new workbook.
Also, would it be possible to omit 4 worksheets that are permanently in the source workbook (these sheets are not in consecutive order)

Any ideas would be greatly appreciated
Thanks

yujin
01-14-2018, 10:19 PM
Something like this?


Sub test()
Dim fName
Application.DisplayAlerts = False
Sheets("temp1").Delete
Sheets("temp2").Delete
Sheets("temp3").Delete
Sheets("temp4").Delete
fName = Application.GetSaveAsFilename
If fName <> False Then ThisWorkbook.SaveAs Filename:=fName
End Sub

podder
01-15-2018, 03:16 AM
Something like this?


Sub test()
Dim fName
Application.DisplayAlerts = False
Sheets("temp1").Delete
Sheets("temp2").Delete
Sheets("temp3").Delete
Sheets("temp4").Delete
fName = Application.GetSaveAsFilename
If fName <> False Then ThisWorkbook.SaveAs Filename:=fName
End Sub

Thanks yujin it worked fine