ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hidden worksheet problem (https://www.excelbanter.com/excel-programming/418732-hidden-worksheet-problem.html)

Patrick C. Simonds

Hidden worksheet problem
 
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.


Per Jessen[_2_]

Hidden worksheet problem
 
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.



joel

Hidden worksheet problem
 
The problem is recognizing the new sheet and making it visible. Try this code.

With ThisWorkbook
.Worksheets("Master").Copy after:=.Worksheets(.Worksheets.Count)
Worksheets(Worksheets.Count).Visible = True
End With

"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.



Patrick C. Simonds

Hidden worksheet problem
 
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.




joel

Hidden worksheet problem
 
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.





ordnance1

Hidden worksheet problem
 
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.




joel

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.




Patrick C. Simonds

Hidden worksheet problem
 
Sir

Thanks for your time and information. I discovered my problem. The
worksheet called Master, was not sheet1. Once I changed it to sheet1
everything worked just as you said it would.


"Patrick C. Simonds" wrote in message
...
Maybe I am missing something. Attached (Capture1) is what I have before I
run the code (where sheet5 (Master) is the hidden sheet. Then after I run
the code (see Capture2) is what I have.



"Joel" wrote in message
...
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.







All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com