ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do you know how to create a new sheet in a file by macro? (https://www.excelbanter.com/excel-programming/281763-do-you-know-how-create-new-sheet-file-macro.html)

dukejas[_2_]

Do you know how to create a new sheet in a file by macro?
 

I need to export data to a file and seperate the data every day.

Do you know how to create a new sheet in a file by macro? How to apply
an existing macro to a new file without creat marcro and copy the code
every time? Because when I export data to a existing file, the macro
is lost.


Thanks a lot ! ---new bird


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Kevin Beckham

Do you know how to create a new sheet in a file by macro?
 
The simplest way is to have a "template" worksheet that
contains the macro. Copy this sheet to the new workbook
then copy the data onto the sheet, viz.
ThisWorkbook.Worksheets("templateSheet").Copy
Set myNewSheet = ActiveSheet

This will copy the named sheet into a new workbook and
retain a reference to the new sheet for data transfer

Kevin Beckham

-----Original Message-----

I need to export data to a file and seperate the data

every day.

Do you know how to create a new sheet in a file by

macro? How to apply
an existing macro to a new file without creat marcro and

copy the code
every time? Because when I export data to a existing

file, the macro
is lost.


Thanks a lot ! ---new bird


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.


dukejas[_3_]

Do you know how to create a new sheet in a file by macro?
 

Thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 04:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com