Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default runtime error 1004 pastespecial method of range class failed


a vba-excel-based application i created for a client has been suffering
from a bug, the runtime 1004 error.

i can't figure out what the problem is, as i've tried it on two
different computers and i can't reproduce it on either of them.


Code:
--------------------

shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy
With shTemp
.Activate
.Range("Q1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End With

--------------------

it fails during the pastespecial method.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=507929

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default runtime error 1004 pastespecial method of range class failed

Is it this line
shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy

if Yes, try fully qualifying those ranges:

with shOppFit
.Range(.Range("Y4:Z4"), .Range("Y4:Z4").End(xlDown)).Copy
end with

The dots in front of the .ranges mean that that thing belongs to the object in
the previous with statement.

Without fully qualifying those ranges, those ranges will refer to the
activesheet (or the worksheet that holds the code--if you're in a worksheet
module).

dreamz wrote:

a vba-excel-based application i created for a client has been suffering
from a bug, the runtime 1004 error.

i can't figure out what the problem is, as i've tried it on two
different computers and i can't reproduce it on either of them.

Code:
--------------------

shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy
With shTemp
.Activate
.Range("Q1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End With

--------------------

it fails during the pastespecial method.

thanks.

--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=507929


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default runtime error 1004 pastespecial method of range class failed

Oops on the .pastespecial line....

Are you using the same version of excel?

xlpastevaluesandnumberformats was added in a newer version. Your client may not
have that newer version.

(maybe do two pastespecials values, then formats??)

dreamz wrote:

a vba-excel-based application i created for a client has been suffering
from a bug, the runtime 1004 error.

i can't figure out what the problem is, as i've tried it on two
different computers and i can't reproduce it on either of them.

Code:
--------------------

shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy
With shTemp
.Activate
.Range("Q1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End With

--------------------

it fails during the pastespecial method.

thanks.

--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=507929


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default runtime error 1004 pastespecial method of range class failed

Does shTemp exist?
--
Gary''s Student


"dreamz" wrote:


a vba-excel-based application i created for a client has been suffering
from a bug, the runtime 1004 error.

i can't figure out what the problem is, as i've tried it on two
different computers and i can't reproduce it on either of them.


Code:
--------------------

shOppFit.Range(Range("Y4:Z4"), Range("Y4:Z4").End(xlDown)).Copy
With shTemp
.Activate
.Range("Q1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats
End With

--------------------

it fails during the pastespecial method.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=507929


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default runtime error 1004 pastespecial method of range class failed


thanks for the replies, everyone.

1. sheets are protected, but get unprotected before getting written.
2. shtemp exists.

this application works on my computer and on another one my office, bu
it doesn't work on the client's computer.

dave, you may be onto something. i talked to the client yesterday, an
found out he's using win2k. i coded this application in excel 2003, bu
he is probably using an older version

--
dream
-----------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...fo&userid=2646
View this thread: http://www.excelforum.com/showthread.php?threadid=50792



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
Runtime 1004 error -- insert method of range class failed. tish Excel Discussion (Misc queries) 1 June 1st 07 04:04 PM
Runtime Error 1004 Select method of Range class Failed IanO Excel Programming 2 June 16th 05 07:40 PM
runtime error '1004' delete Method of Range Class Failed Tom Kennedy Excel Programming 0 April 14th 04 08:08 PM
runtime error '1004' delete Method of Range Class Failed Tom Ogilvy Excel Programming 0 April 1st 04 04:09 AM
Run-time error '1004' PasteSpecial Method of Range Class Failed Kevin G[_2_] Excel Programming 1 February 3rd 04 05:01 AM


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