Consulting

Results 1 to 3 of 3

Thread: Export two sheets to xlsm workbook

  1. #1

    Export two sheets to xlsm workbook

    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

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    That's really fascinating.. It is working exactly as neede
    Thank you very very much for this great help
    Best Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •