Pasting a Name on a Tab through a Macro

squeakums

Well-known Member
Joined
May 15, 2007
Messages
711
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
 

Some videos you may like

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
711
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,720
Members
414,401
Latest member
grenona2020

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