Forum Discussion
Rename multiple sheets in Excel workbook
hia,
this should work.. you will need to add it as a module and then run it..
It will change the name of every worksheet in the workbook, starting with the most left sheet and working right.
Sub rename()
Dim Mydate As Variant
Mydate = InputBox("dd/mm/yy")
For Each sht In ThisWorkbook.Worksheets
sht.Name = Format(Mydate, "dd-mm-yy")
Mydate = DateAdd("d", 1, Mydate)
Next sht
End Sub
It will ask you for a date to start, I know it works with dd/mm/yy so use that.. if you want the date format of the name to be different then you can edit the line:
sht.Name = Format(Mydate, "dd-mm-yy") change the date mask to match what you want.. just remember that you cant use / as that's an illegal character in sheet names.
Normal warnings.. make sure you have a copy of your workbook saved before you press any buttons.. there is no undo with VBA. There is also no error checking with this, so if you do edit the mask and add something it doesn't like it will just fail.
Hope that helps.
- katie.holadayAug 22, 2018Copper Contributor
Thank you SOOOOOO much!!! That saves me so much time : ) IT WORKED
- Philip WestAug 22, 2018Iron Contributor
:)
glad it worked for you.
- katie.holadayAug 22, 2018Copper Contributor
Well it worked the first time i used it just fine. So I created my next quarter....it has 90 tabs and when i run it i put in 11/01/18 as my start date and it puts in 12/12/18 then 1/22/19 then runs normal after that?? I've removed and tried again multiple times and it comes out the same each time?? Any ideas why?