Thread: codename help
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default codename help

That is correct Gary.

Although changeable, the usage for codename assumes it isn't

The alternative (to support variability or to get a list) is to loop through
the objects in the project and pick up the codename property.

See Chip Pearson's code on programming the VBE for insights
http://www.cpearson.com/excel/vbe.htm

and codenames specifically:
http://www.cpearson.com/excel/codemods.htm

although if you are populating a combobox with sheetnames

for each sh in Worksheets
.AddItem sh.name
Next


--
Regards,
Tom Ogilvy

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i think that only works for the sheet name, not the codename

--


Gary


"Carlos" wrote in message
...
Try

dim cname as Worksheet
For i = 1 To 12
set cname = sheets("Sheet" & i)
cname.Select
Next



"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