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?
Thanks all![]()
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
Bookmarks