View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Hidden worksheet problem

Each worksheet has two different names (sheet name, codename). The best way
of seeing this is in the VPA Project Explorer. Go to VBA Editor (Alt-F11).
The select from menu View - Project Explorer. You will see all the sheets
hidden and visible. You will also see both sets of names. The left set of
names will match the Tab Names on the Worksheets. The Right (codename) set
may or may not match. I believe the Master (2) you are seeing is the
codename (right set of names). The codename is read only.

"ordnance1" wrote:

I am afraid on my system the hidden worksheet "Master" does in fact get
renamed. It gets renamed to "Master (2)"

"Joel" wrote:

The code shouldn't fail. Only the new sheet gets renamed. The original
"Master" sheet is still hidden and doesn't get renamed.

"Patrick C. Simonds" wrote:

Thanks.

This does just about almost what I need it to. One problem though is that it
renames the hidden worksheet. It changes it from Master to Master (2) which
means of course, the next time the code is run it fails because it is
looking for Master.

So is there any way to prevent this and to give the newly created worksheet
the name "Blank"?


"Per Jessen" wrote in message
...
Hi

Try this:

Sub CopyHiddenSheet()
'Sheets("Master").Visible = False

Sheets("Master").Copy After:=Sheets(Sheets.Count)
With Sheets(Sheets.Count)
.Name = "Master" & Sheets.Count
.Visible = True
End With
End Sub

Regards,
Per

On 20 Okt., 04:41, "Patrick C. Simonds" wrote:
I would like to create a worksheet and call it Master and have the
worksheet
hidden. What I need is a routine which will create a copy of the hidden
worksheet.