PDA

View Full Version : [SOLVED] Export two sheets to xlsm workbook



YasserKhalil
07-06-2017, 12:21 AM
Hello everyone
I need a code that exports two specific sheets ("July1","July2") to new created xlsm file .. This is not the problem in fact
The exported file needs to be :
* Just values (no formulas at all)
* Delete all named ranges in the new created file
* Delete all the shapes
* Break all the external links in that created workbook

Thanks advanced for help
Regards

mdmackillop
07-06-2017, 03:44 AM
Sub Test()
Dim wb As Workbook
Dim ws As Worksheet
Dim Nm

Sheets(Array("July1", "July2")).Copy
ActiveWorkbook.SaveAs "C:\VBAX\Testing.xlsm", 52
Set wb = ActiveWorkbook
For Each ws In wb.Worksheets
ws.UsedRange.Cells.Value = ws.UsedRange.Cells.Value
ws.DrawingObjects.Delete
Next ws
For Each Nm In wb.Names
Nm.Delete
Next
wb.Save
End Sub

YasserKhalil
07-06-2017, 05:16 AM
That's really fascinating.. It is working exactly as neede
Thank you very very much for this great help
Best Regards