![]() |
Copy hidden worksheet
Hi - trying to modify the below code to copy (ref: Tom Ogilvy) a
hidden worksheet called TEMPLATE but rather than copy to front of the worksheet list trying to enter it 1 sheet in (i.e. after an index page). I have tried changing the Copy Before to Copy After. This places the copied sheet in teh right location but it is copied as a hidden sheet. Sub AddNewSheet() Worksheets("TEMPLATE").Copy Befo=Worksheets(1) Worksheets(1).Visible = xlSheetVisible End Sub Chen anyone help please? Thanks |
Copy hidden worksheet
The worksheet copy will not be index 1 if you are placing it after
worksheet(1). Change code to the following. Sub AddNewSheet() Worksheets("TEMPLATE").Copy After:=Worksheets(1) Worksheets(2).Visible = xlSheetVisible End Sub -- Regards, Nigel "Porky79" wrote in message ... Hi - trying to modify the below code to copy (ref: Tom Ogilvy) a hidden worksheet called TEMPLATE but rather than copy to front of the worksheet list trying to enter it 1 sheet in (i.e. after an index page). I have tried changing the Copy Before to Copy After. This places the copied sheet in teh right location but it is copied as a hidden sheet. Sub AddNewSheet() Worksheets("TEMPLATE").Copy Befo=Worksheets(1) Worksheets(1).Visible = xlSheetVisible End Sub Chen anyone help please? Thanks |
Copy hidden worksheet
Ah I see - Almost there. Copies and creates visable worksheet, but for
some reason then selects the next worksheet as the 'current' or 'active' worksheet. I want the copied sheet to be the active sheet to prevent any data being incorrectly entered. Thanks so much for your time Paul |
Copy hidden worksheet
Sub AddNewSheet()
Worksheets("TEMPLATE").Copy After:=Worksheets(1) Worksheets(2).Visible = xlSheetVisible Worksheets(2).Activate End Sub -- Regards, Nigel "Porky79" wrote in message ... Ah I see - Almost there. Copies and creates visable worksheet, but for some reason then selects the next worksheet as the 'current' or 'active' worksheet. I want the copied sheet to be the active sheet to prevent any data being incorrectly entered. Thanks so much for your time Paul |
Copy hidden worksheet
Make it visible and then select/activate it:
Sub AddNewSheet() Worksheets("TEMPLATE").Copy After:=Worksheets(1) Worksheets(2).Visible = xlSheetVisible worksheets(2).select '<-- added End Sub Porky79 wrote: Ah I see - Almost there. Copies and creates visable worksheet, but for some reason then selects the next worksheet as the 'current' or 'active' worksheet. I want the copied sheet to be the active sheet to prevent any data being incorrectly entered. Thanks so much for your time Paul -- Dave Peterson |
All times are GMT +1. The time now is 06:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com