bramblepants
New Member
- Joined
- Jan 24, 2022
- Messages
- 15
- Office Version
- 365
- Platform
- Windows
Hello again, I have the following code which is exporting the contents of "ITDepExport" to a new file of the user's choosing. I would like to improve this by copying and pasting only rows containing data into the destination file, and then performing the same operation for another sheet ("ITRepExport") and pasting the output to the next available row in the destination.
Please can you help?
Please can you help?
VBA Code:
Sub ITDepExport()
Application.ScreenUpdating = False
Dim fName
With Sheets("ITDepExport")
.UsedRange.Copy
.Cells(1, 1).PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
fName = Application.GetSaveAsFilename(InitialFileName:="", FileFilter:="Excel Files (*.xlsx), *.xlsx", Title:="Save As")
With ActiveWorkbook
.SaveAs FileName:=fName
.Close False
End With
Application.ScreenUpdating = True
End Sub