Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Error 1004 - PasteSpecial failure

Excel XP & 2003
I have a lot of VBA in a file that is being used by a dozen or so offices
throughout the state, one computer per office.
One, and only one, computer is getting a consistent error on the statement:
Dest.PasteSpecial xlPasteValues
I had them insert MsgBox's to determine that "Dest" is in fact a valid cell.
I had them remove and retype that one line just in case some invalid
characters had snuck into the code somehow. I validated every character in
that line to ensure the spelling and syntax is correct. I had another
office send them their file which is working fine, and that file produced
the same error in that one problem office.
Question: Why is this happening and what can be done to correct this?
Thanks for your time. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Error 1004 - PasteSpecial failure

Hard to say what is going on without seeing more code. Assuing that your
destination is valid then the possibilities a

Your copied cells area is larger or smaller than your destination. Copied 5
cells and your destination is only 3 cells.

Somehow the copied cells are no longer copied so your paste fails as there
is nothing to paste.

Like I said if we could see more code it would be easier to diagnose.

As a complete aside usually better than pasting values is to just set the
values equal
dest.Value = range("A1").value
To do this the two ranges must be equal in size.
--
HTH...

Jim Thomlinson


"Otto Moehrbach" wrote:

Excel XP & 2003
I have a lot of VBA in a file that is being used by a dozen or so offices
throughout the state, one computer per office.
One, and only one, computer is getting a consistent error on the statement:
Dest.PasteSpecial xlPasteValues
I had them insert MsgBox's to determine that "Dest" is in fact a valid cell.
I had them remove and retype that one line just in case some invalid
characters had snuck into the code somehow. I validated every character in
that line to ensure the spelling and syntax is correct. I had another
office send them their file which is working fine, and that file produced
the same error in that one problem office.
Question: Why is this happening and what can be done to correct this?
Thanks for your time. Otto



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Error 1004 - PasteSpecial failure

Thanks Jim
Remember that this same code is working on every one of about a dozen
other computers in the state. The copied range is 2 cells and the
destination cell is one cell. The complete Copy/Paste code is:
GreenButton.Offset(, 1).Resize(, 2).Copy
Dest.PasteSpecial xlPasteValues
"GreenButton" is one cell.
"Dest" is one cell.
These 2 lines of code are together as shown so nothing is happening in
between the copy and paste commands to clear the clipboard buffer.
I seem to remember that there is something about a reference that can upset
a VBA paste command but I don't remember more than that. BTW, I checked and
all the VBA references are the same in all offices.
Thanks for your time, Jim. Otto
"Jim Thomlinson" wrote in message
...
Hard to say what is going on without seeing more code. Assuing that your
destination is valid then the possibilities a

Your copied cells area is larger or smaller than your destination. Copied
5
cells and your destination is only 3 cells.

Somehow the copied cells are no longer copied so your paste fails as there
is nothing to paste.

Like I said if we could see more code it would be easier to diagnose.

As a complete aside usually better than pasting values is to just set the
values equal
dest.Value = range("A1").value
To do this the two ranges must be equal in size.
--
HTH...

Jim Thomlinson


"Otto Moehrbach" wrote:

Excel XP & 2003
I have a lot of VBA in a file that is being used by a dozen or so offices
throughout the state, one computer per office.
One, and only one, computer is getting a consistent error on the
statement:
Dest.PasteSpecial xlPasteValues
I had them insert MsgBox's to determine that "Dest" is in fact a valid
cell.
I had them remove and retype that one line just in case some invalid
characters had snuck into the code somehow. I validated every character
in
that line to ensure the spelling and syntax is correct. I had another
office send them their file which is working fine, and that file produced
the same error in that one problem office.
Question: Why is this happening and what can be done to correct this?
Thanks for your time. Otto





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
PasteSpecial Error 1004? DaveM Excel Discussion (Misc queries) 3 February 7th 08 02:41 PM
insert method of Character class failure (error 1004) dlb_dlb Excel Programming 0 July 12th 07 02:44 PM
Runtime Error 1004 when trying to PasteSpecial Phil Davis Excel Discussion (Misc queries) 2 February 16th 06 10:02 PM
runtime error 1004 pastespecial method of range class failed dreamz[_29_] Excel Programming 5 February 3rd 06 02:57 PM
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 11:51 AM.

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"