Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Method 'Copy' of object'_Worksheet failed

Afternoon, new to developing so please go gently on the answers.

I have the following macro to create a number of sheets based on a list, name each sheet as per name on the list and then to copy paste a template onto each sheet. Sounds so (b)loody simple except for a little error message that pops up when its time to copy paste the
template:
Method 'Copy' of object'_Worksheet failed.

The macro looks like this:
Dim wstemp As Worksheet
Dim Rng As Range
Dim ListRng As Range
Set wstemp = Worksheets("Template") 'this is the one to copy
Set ListRng = Range(Range("B7"), Range("B7").End(xlDown))
For Each Rng In ListRng
If Rng.Text < "" Then
wstemp.Copy after:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).Name = Rng.Text End If Next Rng End Sub

And the debug is on this line
wstemp.Copy after:=Worksheets(Worksheets.Count)

So now to the world I ask for your assistance in sorting this little thorn in my side.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,726
Default Method 'Copy' of object'_Worksheet failed

Worked fine for me. Have you got another workbook open?

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"q2w3e4r" wrote in message
...

Afternoon, new to developing so please go gently on the answers.

I have the following macro to create a number of sheets based on a
list, name each sheet as per name on the list and then to copy paste a
template onto each sheet. Sounds so (b)loody simple except for a little
error message that pops up when its time to copy paste the
template:
Method 'Copy' of object'_Worksheet failed.

The macro looks like this:
Dim wstemp As Worksheet
Dim Rng As Range
Dim ListRng As Range
Set wstemp = Worksheets("Template") 'this is the one to copy
Set ListRng = Range(Range("B7"), Range("B7").End(xlDown))
For Each Rng In ListRng
If Rng.Text < "" Then
wstemp.Copy after:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).Name = Rng.Text End If Next Rng End Sub

And the debug is on this line
wstemp.Copy after:=Worksheets(Worksheets.Count)

So now to the world I ask for your assistance in sorting this little
thorn in my side.

Thanks




--
q2w3e4r



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method 'MacroOptions' of object'_Application' failed Runtime Error 1004 EagleOne Excel Discussion (Misc queries) 1 October 22nd 14 05:49 PM
Intermittent Error - Method 'Add' of object 'HPageBreaks' failed Jamey Weare Excel Worksheet Functions 1 December 22nd 06 01:40 AM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Copy worksheet & maintain cell reference across worksheets dingy101 Excel Worksheet Functions 3 January 2nd 06 10:51 AM
Copy Function Genie Bohn Excel Discussion (Misc queries) 0 March 23rd 05 12:28 AM


All times are GMT +1. The time now is 07:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"