Search notes:

Excel VBA: Worksheet.Name

Within a workbook, a (work-)sheet is identified by a unique name. The name is subject to the following restrictions:

Name vs. Codename

A worksheet also has a .codeName property (as also have other objects such as a chart).
These values are equal when the object is created but may be changed independently from each other.
Apparently, the idea of code names is to use it in VBA like so (assuming that the codename property value of a sheet is figures.
figures.cells(3, 2) = "Year 2019"
After creating a new workbook:
sheet1.name = "bar" ' Changes name of tab
sheet1.name = "baz" ' Change it again
? worksheets("bar").codeName ' Evaluates to "sheet1"

'
'  Change code name of sheet is not possible at run time, so the
'  following line throws Run-time error 32183: Application-defined or object-defined error.
'
activeWorkbook.vbProject.VBComponents("Sheet1").name = "NewCodeNameForTheSheet"

'
'  Use new code name:
'
? newCodeNameForTheSheet.name ' Evaluates to "bar"
An example how the value of .codeName might be changed after creating a worksheet programmatically is found here.

Misc

History is a reserved name and cannot be used to name worksheets.

See also

worksheet

Index