Setup Tab as Template and copy as needed

bradjedis
4StarLounger
Posts: 545
Joined: 30 Mar 2010, 18:49
Location: United States

Setup Tab as Template and copy as needed

Post by bradjedis »

Greetings all,

Have an issue where I need to set up sheet as a "template" then have a button on that sheet which will copy the contents of the template to a new tab.

The button should only be available on the Template sheet.

Any ideas?

Thanks,
Brad

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setup Tab as Template and copy as needed

Post by HansV »

Use a command button from the Forms toolbar, so that you can assign a macro in a standard toolbar to it.

Here is the macro:

Code: Select all

Sub CopySheet()
  Dim wshOld As Worksheet
  Dim wshNew As Worksheet
  Set wshOld = ActiveSheet
  wshOld.Copy After:=Worksheets(Worksheets.Count)
  Set wshNew = Worksheets(Worksheets.Count)
  wshNew.Buttons(1).Delete
End Sub
This assumes that the command button will be the first (or only) one on the sheet.
Best wishes,
Hans

bradjedis
4StarLounger
Posts: 545
Joined: 30 Mar 2010, 18:49
Location: United States

Re: Setup Tab as Template and copy as needed

Post by bradjedis »

Thanks Hans.

One question, I do not seem to ba able to locate the forms toolbar. I am in Excel 2007.


Thanks,
Brad

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Setup Tab as Template and copy as needed

Post by HansV »

Activate the Developer tab of the ribbon.
(If you do not see it, click the Office button, then Word Options. If necessary, click Popular. Tick the check box "Show Developer tab in the Ribbon". Click OK.)
Click the Insert button in the Controls group of the ribbon.
The top half of the palette that drops down contains the controls from the Forms toolbar.
Best wishes,
Hans

bradjedis
4StarLounger
Posts: 545
Joined: 30 Mar 2010, 18:49
Location: United States

Re: Setup Tab as Template and copy as needed

Post by bradjedis »

Wow, I got side tracked. Thanks for the detail!

Brad