Hello,

I'm trying to create a VBA code which will insert a new sheet into a workbook upon a button being clicked. I'm using Excel 2010.

What I've tried:

I'm not very good with VBA so I clicked Insert Command Button on the developer tool bar and drew in my button.

In the Visual Basic editor it had something like:

Private Sub CommandButton1_click()

End Sub
I used the Worksheets.Add line to try to add a worksheet, and I re-named the button to Create Account Ledger, however the the name on the button never changed. Also when clicked there was no action.


Ideally I would like that when the button is clicked it would create a new sheet and name that sheet whatever is in Cell D4 on Sheet2. And also I'd like for it to copy all of the cells and formatting from the sheet called 'Template' and paste it into the new sheet with the name of the contents in the Cell D4.


Any help in accomplishing this is much appreciated!!

Thanks,

Jim