LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Copy sheets without macros

I am running a workbook as a template that after the various macros have run
copies all the sheets to a new workbook and then saves it down to a new name.
The problem is it copies all the code too, i do not want to copy the code
across. I am using the code as below and would appreciate advice as to how
to stop the code being copied too.

Dim NewWb As Workbook
Dim ws As Worksheet
Dim i As Integer
Dim NumberSheets As Integer


Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlManual

NumberSheets = Sheets.Count

'creates a new wb:
Sheets(Sheets.Count).Copy
Set NewWb = ActiveWorkbook

For i = NumberSheets - 1 To 1 Step -1
ThisWorkbook.Sheets(i).Copy Befo=NewWb.Sheets(1)
Next i
'Replace Formula with Values:
For Each ws In NewWb.Worksheets
ws.Cells.Copy
ws.Cells.PasteSpecial (xlPasteValues)
ws.Select
ws.Cells(1, 1).Select
Next ws
--
with kind regards

Spike
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy cell info to other sheets, other sheets dont contain all row. Ja Excel Worksheet Functions 1 November 1st 09 12:53 AM
macros over different sheets Robb.rich Excel Worksheet Functions 1 May 2nd 08 11:54 AM
Create New WB with copy of Sheets 1 & 2 when sheets count reaches 100 Corey Excel Programming 5 June 26th 06 04:52 AM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
weird saving of a document with macros resulting with macros being transfered to the copy alfonso gonzales Excel Programming 0 December 12th 04 09:19 PM


All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"