我有一个代码可以保存特定的工作表,您可以在其中选择文件名和路径。问题是它还会在保存新文件时复制公式。我只需要复制值,因为文件太大而且我不需要新保存中的公式,只需要值。
以下是代码:
Dim wb As Workbook, InitFileName As String, fileSaveName As String
InitFileName = ThisWorkbook.Path & "\ - Recon_Output_ " & Format(Date, "yyyymmdd")
Sheets("Source").Copy
Set wb = ActiveWorkbook
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitFileName, _
FileFilter:="Excel files , *.xlsx")
With wb
If fileSaveName <> "False" Then
.SaveAs fileSaveName
.Close
Else
.Close False
Exit Sub
End If
End With
任何建议将不胜感激。谢谢!
答案 0 :(得分:1)
后:
Set wb = ActiveWorkbook
加入:
tempArr = wb.Sheets("Source").UsedRange
wb.Sheets("Source").UsedRange = tempArr