View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Spike Spike is offline
external usenet poster
 
Posts: 140
Default Copy sheets without macros

Many thanks for that, think i will do it like that
--
with kind regards

Spike


"Ron de Bruin" wrote:

You can add a new worksheet each time with code and then copy all cells in this new sheet.
This way you not copy the code

If you need help with the code post back
--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Spike" wrote in message ...
Thjank you very much for your help/reply i think in view of Chuip's comments
re virus scanners etc i foresee big probs so think i will just have to live
with it or just copy and paste each sheet.
--
with kind regards

Spike


"Spike" wrote:

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