The code from this forum is what I used as a starting point. I am trying to modify it to copy multiple sheets and paste them all as values, instead of just one sheet.
I copied multiple sheets using
I think the problem is
because it is only replacing the first sheet as values and leaving the remaining sheets as formulas.
What do I need to change so that all the sheets paste as values?
I copied multiple sheets using
Code:
worksheets(array(1,2,3)).copy
Code:
With ActiveSheet.UsedRange
What do I need to change so that all the sheets paste as values?
Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; white-space: inherit;">[COLOR=#101094]Private[/COLOR][COLOR=#101094]Sub[/COLOR][COLOR=#303336] Workbook_BeforeClose[/COLOR][COLOR=#303336]([/COLOR][COLOR=#303336]Cancel [/COLOR][COLOR=#101094]As[/COLOR][COLOR=#101094]Boolean[/COLOR][COLOR=#303336])[/COLOR][COLOR=#303336]
Application[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]DisplayAlerts [/COLOR][COLOR=#303336]=[/COLOR][COLOR=#7D2727]False[/COLOR][COLOR=#303336]
Worksheets[/COLOR][COLOR=#303336]([/COLOR][COLOR=#303336]Array[/COLOR][COLOR=#303336]([/COLOR][COLOR=#7D2727]"Sheet 1"[/COLOR][COLOR=#303336],[/COLOR][COLOR=#7D2727]"Sheet 2"[/COLOR][COLOR=#303336],[/COLOR][COLOR=#7D2727]"Sheet 3"[/COLOR][COLOR=#303336]).[/COLOR][COLOR=#303336]Copy
[/COLOR][COLOR=#101094]With[/COLOR][COLOR=#303336] ActiveSheet[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]UsedRange
[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]Value [/COLOR][COLOR=#303336]=[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]Value
[/COLOR][COLOR=#101094]End[/COLOR][COLOR=#101094]With[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]Set[/COLOR][COLOR=#303336] wbNew [/COLOR][COLOR=#303336]=[/COLOR][COLOR=#303336] ActiveWorkbook
wbNew[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]SaveAs [/COLOR][COLOR=#7D2727]"L:\Performance Data\UK Sales\Sales (Latest).xlsx"[/COLOR][COLOR=#303336]
wbNew[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]Close [/COLOR][COLOR=#7D2727]True[/COLOR][COLOR=#303336]
Application[/COLOR][COLOR=#303336].[/COLOR][COLOR=#303336]DisplayAlerts [/COLOR][COLOR=#303336]=[/COLOR][COLOR=#7D2727]True[/COLOR][COLOR=#303336]
[/COLOR][COLOR=#101094]End[/COLOR][COLOR=#101094]Sub[/COLOR]</code>