View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
lwidjaya lwidjaya is offline
external usenet poster
 
Posts: 7
Default Copy macro to a new book in 2007

Hi Ron,
thanks a lot! It works for me.
I have another question, how do I copy just a range of cells from each
sheets? Actually, I don't want to include column A. I'm using
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy right now and it copies all
cells in the sheets.

Thanks!



"Ron de Bruin" wrote:

Hi lwidjaya

See
http://www.rondebruin.nl/saveas.htm

I use
ActiveSheet.Copy

But you can also use this to copy more sheets
Sheets(Array("Sheet1", "Sheet3")).Copy




--

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


"lwidjaya" wrote in message ...
I have a master file with a macro in it. When I click a button, the macro
will copy 3 sheets from the master file to a new book. I have macros in 2 of
the sheets that I copy. It works fine (meaning the macros are copied over to
the new book also) until the macro runs the saveas function:
ActiveWorkbook.SaveCopyAs "C:\New\" & NewName & ".xls"
The new file doesn't have any macro in it.
I tried saving the new file as .xlsm and .xlsx but Excel doesn't recognize
the file extensions when I open the new file.
What should I do to keep the macro in the new file?
Thanks in advance.