 <p>This uses the codename as a <em>String</em></p> <pre><code>Sub CodeIt() Dim CodeName As String CodeName = "Sheet1" Dim WS As Worksheet, GetWorksheetFromCodeName As Worksheet For Each WS In ThisWorkbook.Worksheets If StrComp(WS.CodeName, CodeName, vbTextCompare) = 0 Then Set GetWorksheetFromCodeName = WS Exit For End If Next WS MsgBox GetWorksheetFromCodeName.Name End Sub </code></pre>