Automatically inserting macro into new sheets

snowboy001

Board Regular
Joined
Dec 5, 2009
Messages
100
I am working on a sheet that has code put in each worksheet for change tracking. This is something that many other people are going to be using, and I would really like to make it as "idiot-proof" as possible. Is there any way that each time a new sheet is inserted, the code for the worksheets is automatically entered? It is the same code for each sheet, so there is no worry about changes to any of the format.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

harshab6

Active Member
Joined
Oct 1, 2008
Messages
254
hi,
Once we write a macro for the workbook i automatically works for inserted sheet and also the new workbook saved opened after opening a workbook contaning macro.press ALT F8 when box opens containing macro select a particular macro. below there is macro-in with scroll downs select open all workbooks save close and reopen the sheet containing macro.

hope this helps
regards
harsha
 

snowboy001

Board Regular
Joined
Dec 5, 2009
Messages
100
Not quite. I need the code from "Sheet1" to be pasted into the code for each new sheet that is added to the workbook automatically, that way no one has to go in and make changes to the macro coding.
 

snowboy001

Board Regular
Joined
Dec 5, 2009
Messages
100
Figured it out. I just wrote in code to copy the sheet, rename it, clear the contents and move it to the end.
 

Watch MrExcel Video

Forum statistics

Threads
1,132,737
Messages
5,655,012
Members
418,170
Latest member
bkuu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top