I used exactly what you gave me just to see if it would work. Disclaimer: I know almost nothing about macros or VB.
Possibly you did not put the code in the correct module.
The code must be pasted into the module named "ThisWorkbook"
Right-click the Excel icon next to "File" in the menu bar and select "View Code". The VBE will open up and that module will be the active module.
In the code window, paste in the entire bit of code.
Close the VBE.
If it still doesn't work, then you'll need to answer the question about how the new worksheets are created.
At the worst, you can run a macro manually to enter the values for the header. This code assumes the newly added worksheet is the activesheet.
It must be placed into a "Standard Module".
Bookmarks