Automatically rename a sheet based on a cell

clem -  
Zoul67 Posted messages 2001 Status Member -
Hello,
I am looking to automatically rename a sheet based on a cell that is located on that sheet in C6. I have a hundred sheets in the same workbook that I would like to rename automatically, each time based on the C6 cell whose text changes from one sheet to another.
I don’t know anything about macros or VBE, etc., and if this formula exists, it would be a great help!
I am working on Excel 2011 in English, version 14.6.6, on Mac.
Thank you!

Configuration: Mac OS X (10.11.5) / Chrome 54.0.2840.98

4 answers

  1. Zoul67 Posted messages 2001 Status Member 149
     
    Hello,

    Impossible by formula, but definitely by macro...
    Press Alt+F11, in the VBA project explorer (on the left), insert a module and paste:
    Sub rename() Dim sh As Worksheet For Each sh In Worksheets sh.Name = sh.Range("C6") Next End Sub 


    Place your cursor in this code and press the Play button.

    See you later!
    1
    1. clem
       
      Thank you Zoul!
      I managed to do it for the first sheet but not for all the others. When I try the same thing again, Excel shows me: Run-time error '1004': Application-defined or object-defined error
      How can I fix the problem?

      Also, when I change the text in cell C6, it does not automatically change in the sheet name...
      0
    2. Zoul67 Posted messages 2001 Status Member 149
       
      Do you have any empty cells in C6?
      0
      1. Clem > Zoul67 Posted messages 2001 Status Member
         
        Yes, all except one because it's a matrix that I haven't filled in yet.
        0