PC Review


Reply
Thread Tools Rate Thread

Copy hidden worksheet

 
 
Porky79
Guest
Posts: n/a
 
      8th May 2009
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 Before:=Worksheets(1)
Worksheets(1).Visible = xlSheetVisible
End Sub


Chen anyone help please?

Thanks

 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      8th May 2009
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
(E-Mail Removed)



"Porky79" <(E-Mail Removed)> wrote in message
news:01f2621a-d996-43ad-a327-(E-Mail Removed)...
> 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 Before:=Worksheets(1)
> Worksheets(1).Visible = xlSheetVisible
> End Sub
>
>
> Chen anyone help please?
>
> Thanks
>


 
Reply With Quote
 
Porky79
Guest
Posts: n/a
 
      8th May 2009
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
 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      8th May 2009
Sub AddNewSheet()
Worksheets("TEMPLATE").Copy After:=Worksheets(1)
Worksheets(2).Visible = xlSheetVisible
Worksheets(2).Activate
End Sub

--

Regards,
Nigel
(E-Mail Removed)



"Porky79" <(E-Mail Removed)> wrote in message
news:858cd0e3-ac65-4ad6-a10f-(E-Mail Removed)...
> 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


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      8th May 2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy method of worksheet class failed: trying to copy a hidden she sam Microsoft Excel Programming 4 8th Aug 2009 11:19 PM
copy method of worksheet class failed: trying to copy a hidden she sam Microsoft Excel Programming 0 7th Aug 2009 11:16 PM
copy method of worksheet class failed: trying to copy a hidden she sam Microsoft Excel Programming 0 7th Aug 2009 11:16 PM
Macro to Copy hidden worksheet to new worksheet SueDot Microsoft Excel Programming 4 14th Jul 2009 11:01 PM
How do I NOT copy hidden rows to a new worksheet? =?Utf-8?B?U3RldmU=?= Microsoft Excel Misc 3 3rd Mar 2006 05:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:21 AM.