View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Garry Jones Garry Jones is offline
external usenet poster
 
Posts: 28
Default Sheetname variable - Not working

"J.E. McGimpsey" wrote:

You can use the CodeName (see VBA Help) directly:

Sheet1.Name = "NewName"

Note that CodeName cannot be changed programmatically at run-time


Most interesting

Okay.

Each worksheet has two names in properties

(name) and name

My first worksheet is called

Sheet1 under (name)
and
newname under name

If I use the direct code Sheet1.Name = "NewNameAgain" directly it
changes the secondary name.

That's what I want to do, but I want the 1 (in sheet1.name) to be a
variable. I do not want to change the primary name "sheet1", I want to
change the secondary name (currently newname). Surely this is possible?

But

("Sheet" & ArgValue).Name = "NewName"

Is not valid syntax.

Any ideas?

Garry Jones