Home |
Search |
Today's Posts |
#15
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ok, thanks for that, tom. i'll file it away
-- Gary "Tom Ogilvy" wrote in message ... If the code names are sheet2 to sheet13 then Sub ABC() Dim i As Long, sh As Object Dim sStr As String For i = 2 To 13 sStr = ThisWorkbook.VBProject _ .VBComponents("Sheet" & i) _ .Properties("Name").Value MsgBox "Tab name of Sheet" & i & _ " is " & sStr Next End Sub -- Regards, Tom Ogilvy "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... chip: what i was trying to do was loop all sheets based on the code name. the sheet names were all changed, but i knew the code names were sheet1 thru sheet 12. i was trying to concatenate the number onto the end of the word sheet so i could loop. i used index number instead, the index numbers are 2 thru 13. just wanted to use code names in case any sheets were inserted. i used the index (i) variable because i could not figure out how to select the sheet(i) by code name. For i = 2 To 13 Worksheets(i).Activate ActiveSheet.Unprotect Range("b4:i56,k4:p56,r4:t56,v4:af56").ClearContent s ActiveSheet.Protect Range("a1").Select Next -- Gary "Chip Pearson" wrote in message ... If you really need the CodeName, not the Sheet name, try something like Dim N As Integer For N = 1 To 3 Debug.Print ThisWorkbook.VBProject.VBComponents("Sheet" & N).Name Next N "Gary Keramidas" <GKeramidasATmsn.com wrote in message ... i want to loop through 12 sheets, codename sheet1 thru sheet12 why doesn't this work? i = 1 For i = 1 To 12 cname = "Sheet" & i cname.Select Next -- Gary |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
string to codename | Excel Discussion (Misc queries) | |||
Selecting a sheet by codename | Excel Programming | |||
Chart property Codename??? | Excel Programming | |||
Using sheet codename problems | Excel Programming | |||
Worksheet codename | Excel Programming |