Macro to Copy & Paste a Excel file

  • Thread starter Thread starter DNKMCA
  • Start date Start date
D

DNKMCA

Hi,

Is it possible to create a macro that selects all sheets in an excel file
and paste it into new excel with sheet name.

-DNK
 
It's possible, but you could just save that workbook as a new name.

If you look at:
application.savecopyas
in vba's help, you'll see more info.

But if you want...

Option Explicit
Sub testme()

ActiveWorkbook.Sheets.Copy 'to new workbook
'now the new workbook is active
ActiveWorkbook.SaveAs Filename:="c:\newfile.xls", _
FileFormat:=xlWorkbookNormal

End Sub

There is a difference between these two--you'll notice if you have code in
userforms/class modules/general modules.
 
Back
Top