Worksheet tab names

  • Thread starter Thread starter Jed
  • Start date Start date
J

Jed

Is there an automatic way to rename worksheet tabs as per cell content.
For example in cell C2, if there is name Smith i would like to rename the
worksheet as Smith.

Thanks in advance.
Regards
Jed
 
Code
-------------------
Sub renamer()
ActiveSheet.Name = Range("C2").Value
End Su
-------------------


Hope this helps,

Wil
 
Try the macro below (paste in general module)
on a *back-up* copy of your file:

It loops through all worksheets (assumed identical structure)
and renames each sheet with what's in C2 [of each sheet], all at one go.

(It's assumed C2 will hold for example, text - different for each sheet,
and with no illegal characters, etc)

Sub RenameWS()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
ws.Name = Range("C2").Value
Next
End Sub
 
Thanks Max,
That's what i was looking for. Your response is much appreciated.

Regards
Jed

Max said:
Try the macro below (paste in general module)
on a *back-up* copy of your file:

It loops through all worksheets (assumed identical structure)
and renames each sheet with what's in C2 [of each sheet], all at one go.

(It's assumed C2 will hold for example, text - different for each sheet,
and with no illegal characters, etc)

Sub RenameWS()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
ws.Name = Range("C2").Value
Next
End Sub

--
hth
Max
-----------------------------------------
Please reply in thread

Use xdemechanik <at>yahoo<dot>com for email
-------------------------------------------------------
Jed said:
Is there an automatic way to rename worksheet tabs as per cell content.
For example in cell C2, if there is name Smith i would like to rename the
worksheet as Smith.

Thanks in advance.
Regards
Jed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top