Take tab name and add to worksheet for that tab

xerxers

Board Regular
Joined
Nov 30, 2005
Messages
140
I have a spreadsheet that has many Tabs. I have named each of the tabs with a unique name. I would now like to insert that tab Name into each worksheet in location A1 without having to retype the name each time.

TIA
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
How about
Code:
Sub xerxers()
   Dim Ws As Worksheet
   
   For Each Ws In Worksheets
      Ws.Range("A1").Value = Ws.name
   Next Ws
End Sub
 
Upvote 0
How about
Code:
Sub xerxers()
   Dim Ws As Worksheet
   
   For Each Ws In Worksheets
      Ws.Range("A1").Value = Ws.name
   Next Ws
End Sub

Thank you for your response, much appreciated, now how do I actually get this to run in my spreadsheet, sorry... :)
 
Upvote 0
Paste it into a normal module & on then in excel press Alt F8, select the macro & click run
 
Upvote 0
I apologize for being so dumb but I presume a normal module is a worksheet or is it something else.
I have copied it into a worksheet, selected ALT F8 but the subroutine does not appear.
 
Upvote 0
The other option is to put this formula in A1 of each sheet
=TRIM(RIGHT(SUBSTITUTE(CELL("filename"),"]",REPT(" ",100)),100))
 
Upvote 0
Once again thank you for your response, did a Google search and was able to get everything running just fine.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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
Back
Top