Pasting a Name on a Tab through a Macro

squeakums

Well-known Member
Joined
May 15, 2007
Messages
760
I can't seem to figure out how to paste a name onto a tab in vba. In regular excel I can use use the ctrl and v option. But, how would you write to paste a copied name on a tab through a macro?

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 3/21/2009 by test
'

'
Windows("Test's Team (Individual Monthly).xls").Activate
Sheets("Template").Select
Sheets("Template").Copy After:=Sheets(1)
Windows("Test's Team (By Group).xls").Activate
Sheets("Monthly Logged Details").Select
Range("A2").Select
Selection.Copy
Windows("Test's Team (Individual Monthly).xls").Activate
ActiveSheet.Paste
Sheets("Template (2)").Select
Sheets("Template (2)").Pastevalues
Range("A1:N1").Select
Windows("Macro.xls").Activate
Range("A1").Select
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
Maybe
Code:
Sheets("Template (2)").name = "whatever new name"
 

squeakums

Well-known Member
Joined
May 15, 2007
Messages
760
That will name the tab - whatever new name. I would like for it to paste a name that I copied. How would I do that?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,990
Messages
5,834,746
Members
430,315
Latest member
bobh63

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