Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2003 "bug"

I have an Excel vba program that works correctly in Excel
97, 2000 and 2002, but not in 2003.
A basic command of "Range("B1").select" followed
by "activesheet.paste" fails with the error...

Run-time error '1004':
Paste method of worksheet class failed

Here is the code that leads up to the error...

Sheets("Live").Select
Range("A65536").Select
Selection.End(xlUp).Select
Rows("2:" & ActiveCell.Row).Select
Selection.Sort Key1:=Range("A2"),
Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlNo,
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
Range("A65536").Select
Selection.End(xlUp).Select
Last_Row_Number = ActiveCell.Row

Range("J2") = "=IF(OR(A2<A1,C2<C1),E2,E2+J1)"
Range("K2") = "=IF(AND(A2=A3,C2=C3),0,J2)"
Range("J2:K2").Copy
Range("J2:K" & Last_Row_Number).Select
ActiveSheet.Paste

Sheets("Live").Select
Columns("K:K").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<0",
Operator:=xlAnd

Columns("A:A").Select
Selection.Copy
Sheets("Live_byDay").Select
'the code fails here by not being able to select a cell
and then paste the contents of column A copied from
another sheet
Range("B1").Select
ActiveSheet.Paste
Application.CutCopyMode = False

The code works correctly in previous versions of Excel,
so I'm going to guess that it is a "bug". Does anyone
know whether this is the case? Or have a solution?
I have another Excel program where similar lines of code
creates the same error (but only in Excel 2003).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Excel 2003 "bug"

I have 2003, so I thought I would try a couple of simple
copy and pastes. I did two, one on the same sheet and a
second to another sheet and they both worked. I am not
working with yur data, etc., so I am not sure what is
happening, but worked ok in these sircumstances. Granted
they are very simple.

-----Original Message-----
I have an Excel vba program that works correctly in

Excel
97, 2000 and 2002, but not in 2003.
A basic command of "Range("B1").select" followed
by "activesheet.paste" fails with the error...

Run-time error '1004':
Paste method of worksheet class failed

Here is the code that leads up to the error...

Sheets("Live").Select
Range("A65536").Select
Selection.End(xlUp).Select
Rows("2:" & ActiveCell.Row).Select
Selection.Sort Key1:=Range("A2"),
Order1:=xlAscending, Key2:=Range("C2") _
, Order2:=xlAscending, Header:=xlNo,
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
Range("A65536").Select
Selection.End(xlUp).Select
Last_Row_Number = ActiveCell.Row

Range("J2") = "=IF(OR(A2<A1,C2<C1),E2,E2+J1)"
Range("K2") = "=IF(AND(A2=A3,C2=C3),0,J2)"
Range("J2:K2").Copy
Range("J2:K" & Last_Row_Number).Select
ActiveSheet.Paste

Sheets("Live").Select
Columns("K:K").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<0",
Operator:=xlAnd

Columns("A:A").Select
Selection.Copy
Sheets("Live_byDay").Select
'the code fails here by not being able to select a cell
and then paste the contents of column A copied from
another sheet
Range("B1").Select
ActiveSheet.Paste
Application.CutCopyMode = False

The code works correctly in previous versions of Excel,
so I'm going to guess that it is a "bug". Does anyone
know whether this is the case? Or have a solution?
I have another Excel program where similar lines of code
creates the same error (but only in Excel 2003).
.

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
Excel 2003: Conditional Formatting using "MIN" & "MAX" function MMangen Excel Discussion (Misc queries) 2 September 16th 08 07:13 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to entre a "pattern" in a column chart? "used to be in 2003" Mecckey Excel Discussion (Misc queries) 1 June 7th 08 02:28 AM
In Excel 2003 is there a way to prevent "Save As" and "Print"? lucky2000 Excel Discussion (Misc queries) 3 April 26th 07 02:49 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 04:06 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"