Mudface said:If you're referring to the worksheet's CodeName, you can only change this at design time through the properties window, not programatically.
Sub AChangeOfName()
ThisWorkbook.VBProject.VBComponents("Sheet1").Name = "Mudface"
'change the codename for Sheet1 to Mudface
End Sub
I want to have 12 worksheets all labeled with the months of the year. How do I get them to only have the first three letters of the month? For example: "Jan '14" "Feb '14" "Mar '14"..etc.
Thanks!
You have probably solved the issue by now. But, I came across your post while trying to solve pretty much the same problem. Here is what I came up with:
Public Sub InitializeWB()
Dim i As Integer
i = 1
Dim WrkSheet As Worksheet
For i = 1 To 12
If i > Worksheets.Count Then
Set WrkSheet = Sheets.Add(After:=Sheets(Worksheets.Count))
Else
Set WrkSheet = Sheets(Worksheets.Count)
End If
WrkSheet.Name = CStr(MonthName(i, True)) & " '14"
Next i
End Sub
Hope it helps.
If you're referring to the worksheet's CodeName, you can only change this at design time through the properties window, not programatically.