View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Kosensky Tom Kosensky is offline
external usenet poster
 
Posts: 1
Default Copy Method of Workseet Class Failed

Hey there,

I am having an issue with one of my macros, and was wondering if anyone here
can help.

To start off, I have searched throughout Google, and it seems that the only
answer I can find on there has to do with issues in previous versions of
Excel - problems that were solved in Excel 2002, which is what I have.

Anyways, I have a fairly big project where I am running 400 records of data
through a macro - it runs fine up until record 280, when I get the error
listed above. Pretty much, the 400 records are getting split into MANY
different workbooks - up to 100 different workbooks based on various
criteria.

Here is the code itself:

Set wkb = Workbooks("Initialize.xls")
wkb.Activate
Sheets("Template").Select

''The next line is where the error occurs
Sheets("Template").Copy Befo=Workbooks(WksVar.Range("Filename").Value &
"msts.xls").Worksheets(1)

Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False