Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Paste works sometimes?

I assume neither the source or destination contain merged cells and neither
is protected. You might try

Dim obj as Window
set obj = ActiveWindow
ActiveWindow.Visible = False
Windows("060631 Charts_DataDown.xls").Activate
Sheets("Datadown").Select
Rows("7:7").Select
Range("J7").Activate
Selection.AutoFilter
ActiveWindow.LargeScroll ToRight:=1
Selection.AutoFilter Field:=13, Criteria1:="12/31/2004",
Operator:=xlAnd _
, Criteria2:="<1/1/2006"
Cells.Select
Selection.Copy

obj.visible = True
obj.Activate
Sheets("2005").Select
Worksheets("2005").Activate
Range("A1").Select
ActiveSheet.Paste

--
Regards,
Tom Ogilvy


"Craigm" wrote in
message ...

The code below runs sometimes then it crashes other times with a "Paste
Method of Worksheet Class Failed". The Debugger stops on the
"ActiveSheet.Paste" line.

It always copies and pastes the correct filtered data. It may have
something to do with the filter being on or off before the routine is
run??? Thats a guess.

I've tried to fix this so may ways I can't think anymore.

Any ideas? Thanks!

----------------------------------------
ActiveWindow.Visible = False
Windows("060631 Charts_DataDown.xls").Activate
Sheets("Datadown").Select
Rows("7:7").Select
Range("J7").Activate
Selection.AutoFilter
ActiveWindow.LargeScroll ToRight:=1
Selection.AutoFilter Field:=13, Criteria1:="12/31/2004",
Operator:=xlAnd _
, Criteria2:="<1/1/2006"
Cells.Select
Selection.Copy

Sheets("2005").Select
Worksheets("2005").Activate

ActiveSheet.Paste Destination:=Worksheets("2005").Range("A1")
--------------------------------------


--
Craigm
------------------------------------------------------------------------
Craigm's Profile:

http://www.excelforum.com/member.php...o&userid=24381
View this thread: http://www.excelforum.com/showthread...hreadid=385573



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
paste from excel to works database all it shows is "picture" MLagrone Excel Discussion (Misc queries) 1 October 6th 08 02:58 AM
Cell Paste using cell link option Half works MardiT Excel Worksheet Functions 4 July 28th 08 06:51 PM
HELP! Copy/Paste Macro Works on PC But Not Mac! Wart Excel Discussion (Misc queries) 4 May 14th 08 06:56 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM


All times are GMT +1. The time now is 05:18 PM.

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"