Results 1 to 3 of 3

Macro to export worksheets as xlsm with Values not Formulas

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Macro to export worksheets as xlsm with Values not Formulas

    I am using the below code at the end of my mod to copy and export my workbook without it's formulas and macros. Seems to work well, but if I want to exclude a couple of worksheets from the file that it exports, what do I need to add?
        
    Dim Output As Workbook
        Dim Current As String
        Dim FileName As String
    
        Set Output = ThisWorkbook
        Current = ThisWorkbook.FullName
    
        Application.DisplayAlerts = False
    
        Dim SH As Worksheet
        For Each SH In Output.Worksheets
    
            SH.UsedRange.Copy
            SH.UsedRange.PasteSpecial xlPasteValues, _
                Operation:=xlNone, SkipBlanks:=True, Transpose:=False
    
        Next
    
        FileName = ThisWorkbook.Path & "S:\Location\" & "air.xlsx"
          Output.SaveAs FileName:="S:\Location\air.xlsx", _
                    FileFormat:=xlOpenXMLWorkbook
        'Workbooks.Open Current
        'Output.Close
        Application.DisplayAlerts = True
    
    End Sub
    Thanks all
    Last edited by JPSIMMON; 11-04-2015 at 01:04 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formulas & Some Macro Codes removed in .xlsm?
    By jamewoong in forum Excel General
    Replies: 2
    Last Post: 09-08-2015, 09:09 PM
  2. Cannot export htm from xlsm
    By lkikl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-02-2015, 02:10 AM
  3. [SOLVED] Exporting Worksheets as xlsm with Values not Formulas
    By JPSIMMON in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-21-2015, 05:49 PM
  4. Export data to protected xlsm file
    By namialus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-22-2014, 08:26 AM
  5. Save file xls file as xlsm - macro won't run in xlsm workbook
    By captbluefin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2012, 11:39 AM
  6. Replies: 1
    Last Post: 02-11-2011, 05:39 PM
  7. transferspreadsheet does not export xlsm
    By jmccullough in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2009, 10:27 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1