Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying worksheet error


Hi,
I have made a macro that copies worksheets from diffrent workbooks, and
then places the worksheets into the same workbook. This is a pretty
simpel function, but when I have copied to many sheets I recive an
error 1004. Is there an easi way to come around this ?

This is in a loop:
sourceWb.Worksheets("Prodject-" & year).Copy
after:=thisWb.Sheets(thisWb.Worksheets.count)


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=394664

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Copying worksheet error

hi,
Not sure what the problem is that cause it. it has something to do with the
clipboard.
from experience, i have learned not to use the copy command in a loop.
usually crashes the macro with memory error messages. using it once or twice
in a macro is ok but not in any kind of loop. there are other ways.
and this is not unique to xl. i had the same problem with lotus 123. and the
cut command is even worst.
try this just before the copy command........

application.cutcopymode = false

this will clear your clipboard just before the copy and may solve your
problem. post back if it doesn't.

regards
FSt1

"Newbie80" wrote:


Hi,
I have made a macro that copies worksheets from diffrent workbooks, and
then places the worksheets into the same workbook. This is a pretty
simpel function, but when I have copied to many sheets I recive an
error 1004. Is there an easi way to come around this ?

This is in a loop:
sourceWb.Worksheets("Prodject-" & year).Copy
after:=thisWb.Sheets(thisWb.Worksheets.count)


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=394664


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying worksheet error


Still fails


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=394664

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Copying worksheet error

Hi Newbie80,

See MSKB # 210684:

'Copying worksheet programmatically causes run-time error 1004 in Excel'

http://tinyurl.com/9283s


---
Regards,
Norman



"Newbie80" wrote in
message ...

Still fails


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile:
http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=394664



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying worksheet error


This is the problem, seems like I need to close and reopen th
workbook.

Seems to be a built in problem/bug in the Copy-method :

--
Newbie8
-----------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...fo&userid=2594
View this thread: http://www.excelforum.com/showthread.php?threadid=39466

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
Copying worksheet, path/file access error: '\vbxxx.tmp' goneill3 Excel Discussion (Misc queries) 7 April 4th 23 10:45 AM
Error when copying worksheet Mike Excel Discussion (Misc queries) 0 May 18th 09 04:36 PM
Excel 2003 converted to 2007 copying worksheet error MAC Excel Discussion (Misc queries) 0 September 6th 07 08:16 PM
Error Copying Worksheet Steve King Excel Worksheet Functions 1 April 13th 05 09:49 PM
Copying data to another worksheet gives "Type Mismatch" error TB[_3_] Excel Programming 6 July 28th 03 12:44 PM


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

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

About Us

"It's about Microsoft Excel"