View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
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