• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Save Selected tabs as values, formats to new workbook

brianmock

Member
I am trying to:
(1) loop through all the worksheets in the source workbook
(2) copy the visible ones
(3) paste to open workbook as formats and values

Specifications:
(1) I have several files with 60+ worksheets
(2) I need one loop to produce an "East" file and another for "West", etc.
(3) it needs to be saved in .xls and .xlsx formats (Source is in .xlsb to save space)

Problem:
I do not understand how to copy/paste with the
With Sourcewb.sheets.UsedRange.copy statement
 

Attachments

  • Save to New Workbook Example.xlsm
    25.3 KB · Views: 3
The part of the code I am having trouble understanding is
Static Sub DailyReport()
Set Sourcewb = ThisWorkbook
Call HideUnHideGraphSheets("Hidden")
Workbooks.Open Filename:="C:\Users\Documents\Daily Reports\date.xls"
Set Destwb = ThisWorkbook
Sourcewb.Activate
For Each ws In Sourcewb.Worksheets
If ws.Name <> "Parameters" And ws.Visible = xlSheetVisible Then
With Sourcewb.Sheets(ws).Cells
.UsedRange.Copy
End With
Destwb.Activate
With Destwb.Sheets(ws).Range.Cells
.PasteSpecial xlPasteFormats
.PasteSpecial xlPasteValues
End With
End If
Next 'ws
Sourcewb.Activate
Call HideUnHideGraphSheets("Visible")

End Sub
 
Back
Top