Forum Discussion
Hursh Patel
Jun 15, 2018Copper Contributor
I would like to rename all the sheets from a list of names I have
I have 112 sheets and 112 names, I would like to rename all of the sheets. How can I do this?
- Jun 15, 2018
Hi Hursh,
You can do this by using a VBA code!
But you need to have these name listed in a worksheet stating from cell A1 as follows:
Then you can depend on this code to rename all worksheets at once:
Sub rename()
Dim r As Integer
r = 1
For Each Sheet In Sheets
Sheet.Name = Cells(r, 1).Value
r = r + 1
Next
End SubThis code will loop through each worksheet and rename the Sheet1 with the name of cell A1, Sheet2 with the name of cell A2, and so on.
Please check this link to learn how to insert and run this code.
Regards
Chi Nguyen
Oct 23, 2018Copper Contributor
How would you do the reverse? Capture the list of all the worksheet names.
BobOrrell
Oct 23, 2018Iron Contributor
You would change
Sheet.Name = Cells(r, 1).Value
to
Cells(r, 1).Value = Sheet.Name
Please note: This code will overwrite any data that is in the cells in column A of the worksheet that is active when you run it.