A macro to name worksheets based on a list

Closed
nilam28 - Apr 22, 2015 at 12:41 AM
 nilam28 - Apr 22, 2015 at 09:29 PM
Hello,

btw how to name worksheet without creating new worksheets, i've already have data in each worksheet so i dont need to create a new one.. I had the list of the worksheets name in sheet "Master" range "A1:A30".. Is there anyone can help me to solve this?

thanks..

1 response

MaxStart Posts 339 Registration date Tuesday March 3, 2015 Status Moderator Last seen July 3, 2015 69
Apr 22, 2015 at 10:56 AM
this is a very rough code you really must code an error handler for it
Sub reName()
'Kioskea.net
Dim i As Integer, Count As Integer
i = 1
Count = Sheets.Count

Do Until Sheets(1).Cells(i, 1).Value = ""
    If i < Count Then
        If i = 1 Then
            Sheets(2).Name = Sheets(1).Cells(i, 1).Value
        Else
            Sheets(Count - (Count - i) + 1).Name = Sheets(1).Cells(i, 1).Value
        End If
    End If
i = i + 1
Loop

End Sub
0
Thank you for your response..
I tried your code, but it didnt solve the problem.. So I have 30 Sheets named "Sheet1" until "Sheet30" and I have another Sheet named "Master" range "A1:A30" cointains the name for rename "Sheet1" until "Sheet30", like this:
A B
1 Combined Sheet1
2 CM Sheet2
3 YTD Sheet3
. . .
. . .
. . .
. . .
. . .
. . .
30 Fixed Sheet30

Coloumn A contains the new Sheets name and coloumn B contains the old Sheets name..
0