View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Copy for Backup Purpose.

Michael,

Sub testit()
Dim wkbSource As Workbook, wkbDest As Workbook, wks As Worksheet
Dim blnFirstWks As Boolean

Set wkbSource = Workbooks.Open("C:\data.xls")

blnFirstWks = True
For Each wks In wkbSource.Worksheets
If blnFirstWks Then
wks.Copy
Set wkbDest = ActiveWorkbook
blnFirstWks = False
Else
wks.Copy After:=wkbDest.Worksheets(wkbDest.Worksheets.Count )
End If
With wkbDest.Worksheets(wkbDest.Worksheets.Count).Cells
.Copy
.PasteSpecial Paste:=xlValues
.Cells(1, 1).Select
End With
Next
Application.CutCopyMode = False

wkbDest.SaveAs "C:\Backup.xls"

wkbSource.Close False
wkbDest.Close False
End Sub

Rob


"Michael168" wrote in message
...
Hi, A Happy New Year Greetings to everybody here.

I hope someone here can help me for this task.
I have a file say "Data.xls" which has 25 sheets under different names.
I like to copy all the 25 sheets of "Data.xls" to a new file say
"Backup.xls" which contain only the values excluding all the formulas
and macros.

Any kind help is appreciated.
Thank you.

Michael


---
Message posted from http://www.ExcelForum.com/