Export data to Excel workbook, make a copy, then copy and paste values in Excel

Not sure if this is possible.  I have a report that is updated daily (Sales File #1).  When updated, old data is replaced by new data each morning via an MS ACCESS Macro.
Sheet 1:  Contains data with calculations, vlookups, etc.
Sheet 2:  Contains about 3000 rows of data that are exported each morning. Once exported, data in Sheet 1 automatically update.

Now the Sales department wants me to create a copy (Sales File # 2), copy and paste values on sheet 1. When updated, old data is replaced by new data each morning.  They do not want me to include the raw data from sheet 2.

Purpose is to reduce file size, this report was converted to PDF and emailed each day.  Now they want to be able to filter data and play with the numbers.  Therefore are requesting the actual excel file in lieu of the PDF file.

Is this possible?  What are the chances of the file corrupting each day?
gracie1972Asked:
Who is Participating?
 
Roy CoxGroup Finance ManagerCommented:
Is this what you want?

Option Explicit

Sub MakeCopy()
    Dim TempSht As Worksheet
    Set TempSht = Sheets.Add
    '/// Convert to Values
    ActiveSheet.Cells.Select
    Selection.Copy
    Selection.PasteSpecial xlValues
    ActiveSheet.Name = Format(Date, "dd_mmmm_yyyy")
    'create report to email
    ActiveSheet.Move
    ActiveWorkbook.SaveAs "Sales File " & Format(Date, "dd_mmmm_yyyy"), FileFormat:=51, CreateBackup:=False
    '/// this line will clear data from the original file leaving header row
    '/// header row assumed to be in Row 1
    ThisWorkbook.Sheets(1).Range("A1").Offset(1).CurrentRegion.ClearContents

End Sub

Open in new window


You can add code to automatically email the report
0
 
ThomasMcA2Commented:
A worksheet can be copied to another workbook with a single command:
currentSheet.Copy Before:=Workbooks("Sales File # 2").Sheets(sheetIndex)

Open in new window

0
 
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.