• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to rename sheets

jtsuperman34

New Member
Hello, I have the code below, that will change my sheet name to reflect "C1". But I would like to have this code start from sheet two instead of sheet one. Also I would like it to rename every sheet in my workbook after sheet one according to the information in "C1". Appreciate the help.

Code:
Sub RenameSheet()

Dim rs As Worksheet

For Each rs In Sheets
rs.Name = rs.Range("C1")
Next rs

End Sub
 
The issue with your goal involves naming every sheet in the workbook the same name.
Excel will not let you do that.
 
But I would like to have this code start from sheet two instead of sheet one.
Instead of
Code:
rs.Name = rs.Range("C1")
:
try:
Code:
if rs.name <> "theNameOfTheSheetYouDontWantToChange" Then rs.Name = rs.Range("C1")

I would like it to rename every sheet in my workbook after sheet one according to the information in "C1"
What's in C1 of the first sheet? Is it a list or something? As Logit says, you can't name all sheets the same.
 
Last edited:
I have my workbook set with auto page breaks. So “C1” is different on every page except the master sheet which is sheet one. In my case sheet is a route number and I want the name of the sheets to reflect which route I am working on.
 
rename every sheet in my workbook after sheet one according to the information in "C1"
So you no longer want this?

edit post posting: I get it, it's not that you want the sheets named in C1 of the sheet one, but you only want to name sheets according to what's in their C1, except for sheet one. In which case my answer in msg#3 applies still, or one of the answers in your cross-post(s).
 
Back
Top