I want to rename excel sheet name tab automatically based on a cell (in the same sheet).
i know little about VBA but i could find this code which should work.. but it doen't.
can you help correct this code or provide an alternative solution.
'Renames all worksheet tabs with each worksheet's cell A5 contents.
'If cell A5 has no content, then the tab is named as "Default"
For i = 1 To Sheets.Count
If Worksheets(i).Range("A5").Value <> "" Then Sheets(i).Name = Worksheets(i).Range("A5").Value
Else: Sheets(i).Name = "Default (" & i & ")"