Question : Copy worksheets to new workbook

I need to create a macro/vba code to copy two worksheets to a new workbook. These two worksheets have calculations on it so I need copy and paste these worksheets as values in a new workbook. But I want to keep the formatting of the worksheets the same. And I also need to name this new workbook a certain name. Can anyone shed some light on how I might do this?

Answer : Copy worksheets to new workbook

No probs :)

Like so to save  c:\myfile.xlsx (with overwrite turned on by suppressing 'the file exists' message)

Cheers
Dave
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Sub toNew()
    Dim ws As Worksheet
    Sheets(Array("Sheet1", "Sheet2")).Copy
    For Each ws In ActiveWorkbook.Worksheets
        ws.UsedRange.Value = ws.UsedRange.Value
    Next ws
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs "c:\myfile.xlsx"
     Application.DisplayAlerts = True
End Sub
Random Solutions  
 
programming4us programming4us