ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PasteSpecial giving error #1004 (https://www.excelbanter.com/excel-programming/416552-pastespecial-giving-error-1004-a.html)

[email protected]

PasteSpecial giving error #1004
 
Hi,

I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.

With Sheets("Order")
.Range("A2:V200").Delete

Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!

any suggestions?

thx

Gary''s Student

PasteSpecial giving error #1004
 
Your code works. Make sure the tab names are spelled correctly.
--
Gary''s Student - gsnu200802


" wrote:

Hi,

I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.

With Sheets("Order")
.Range("A2:V200").Delete

Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!

any suggestions?

thx


Gary Keramidas

PasteSpecial giving error #1004
 
works here, i know you can get a 1004 error if the sheet's protected, but you
say it runs on other pc's.

--


Gary


wrote in message
...
Hi,

I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.

With Sheets("Order")
.Range("A2:V200").Delete

Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!

any suggestions?

thx




[email protected]

PasteSpecial giving error #1004
 
On Sep 4, 12:29*pm, Gary''s Student
wrote:
Your code works. *Make sure the tab names are spelled correctly.
--
Gary''s Student - gsnu200802



" wrote:
Hi,


I have a weird problem. *I've created a workbook that dozens of sales
people use. *One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


* * With Sheets("Order")
* * * * .Range("A2:V200").Delete


* * * * Sheets("OrderPrep").Range("B3:U29").Copy
* * * * .Range("B1").PasteSpecial xlPasteValues
* * * * .Range("B1").PasteSpecial xlPasteFormats
* * End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. *I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


It's nothign wrong with the workbook, it's gotta be a setting
somewhere. It works fine on 11 other computers.

Gary Keramidas

PasteSpecial giving error #1004
 
what's the text of the 1004 error?

--


Gary


wrote in message
...
On Sep 4, 12:29 pm, Gary''s Student
wrote:
Your code works. Make sure the tab names are spelled correctly.
--
Gary''s Student - gsnu200802



" wrote:
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


It's nothign wrong with the workbook, it's gotta be a setting
somewhere. It works fine on 11 other computers.



Gary''s Student

PasteSpecial giving error #1004
 
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802


"Gary Keramidas" wrote:

works here, i know you can get a 1004 error if the sheet's protected, but you
say it runs on other pc's.

--


Gary


wrote in message
...
Hi,

I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.

With Sheets("Order")
.Range("A2:V200").Delete

Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!

any suggestions?

thx





[email protected]

PasteSpecial giving error #1004
 
On Sep 4, 1:00*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
what's the text of the 1004 error?

--

Gary

wrote in message

...
On Sep 4, 12:29 pm, Gary''s Student





wrote:
Your code works. Make sure the tab names are spelled correctly.
--
Gary''s Student - gsnu200802


" wrote:
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


It's nothign wrong with the workbook, it's gotta be a setting
somewhere. *It works fine on 11 other computers.- Hide quoted text -

- Show quoted text -


"Error #1004: Merged Cells must be identically sized"

[email protected]

PasteSpecial giving error #1004
 
On Sep 4, 1:08*pm, Gary''s Student
wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802



"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected, but you
say it runs on other pc's.


--


Gary


wrote in message
....
Hi,


I have a weird problem. *I've created a workbook that dozens of sales
people use. *One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


* *With Sheets("Order")
* * * *.Range("A2:V200").Delete


* * * *Sheets("OrderPrep").Range("B3:U29").Copy
* * * *.Range("B1").PasteSpecial xlPasteValues
* * * *.Range("B1").PasteSpecial xlPasteFormats
* *End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. *I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.

Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. So it's most definately not the code but rather
something in that particular instance of excel.

Gary Keramidas

PasteSpecial giving error #1004
 
there must be a merged cell on the order sheet. put a breakpoint on this line
Sheets("OrderPrep").Range("B3:U29").Copy

and see if there is a merged cell in the are you're trying to copy to.

--


Gary


wrote in message
...
On Sep 4, 1:08 pm, Gary''s Student
wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802



"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected, but
you
say it runs on other pc's.


--


Gary


wrote in message
...
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.

Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. So it's most definately not the code but rather
something in that particular instance of excel.



Gary Keramidas

PasteSpecial giving error #1004
 
or try this
.Range("A2:V200").Clear
instead of
..Range("A2:V200").Delete

--


Gary


wrote in message
...
On Sep 4, 1:08 pm, Gary''s Student
wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802



"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected, but
you
say it runs on other pc's.


--


Gary


wrote in message
...
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.

Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. So it's most definately not the code but rather
something in that particular instance of excel.



[email protected]

PasteSpecial giving error #1004
 
On Sep 4, 2:30*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
or try this
*.Range("A2:V200").Clear
instead of
.Range("A2:V200").Delete

--

Gary

wrote in message

...
On Sep 4, 1:08 pm, Gary''s Student





wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802


"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected, but
you
say it runs on other pc's.


--


Gary


wrote in message
....
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.

Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. *So it's most definately not the code but rather
something in that particular instance of excel.- Hide quoted text -

- Show quoted text -


I fixed it. The solution is simple, the reason who the hell knows.


Instead of using PasteSpecial, I just combined it into one command

with Sheets("OrderPrep")
..Range("B3:U29").Copy .Range("B1")
end with



[email protected]

PasteSpecial giving error #1004
 
On Sep 4, 2:42*pm, wrote:
On Sep 4, 2:30*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:





or try this
*.Range("A2:V200").Clear
instead of
.Range("A2:V200").Delete


--


Gary


wrote in message


...
On Sep 4, 1:08 pm, Gary''s Student


wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802


"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected, but
you
say it runs on other pc's.


--


Gary


wrote in message
...
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.


Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. *So it's most definately not the code but rather
something in that particular instance of excel.- Hide quoted text -


- Show quoted text -


I fixed it. *The solution is simple, the reason who the hell knows.

Instead of using PasteSpecial, I just combined it into one command

with Sheets("OrderPrep")
.Range("B3:U29").Copy .Range("B1")
end with- Hide quoted text -

- Show quoted text -


I'd like to re-open this thread...

My solution above isn't good. Using the .Copy method with the
destination passed along will change references and that's not cool,
as I need it to copy the values only.

So...Does anybody have any idea why a PasteSpecial would cause erro
1004 "merged cells must be identically sized" on one instance of
excel, but not another?

thx

Gary Keramidas

PasteSpecial giving error #1004
 
see if this, at least, works without errors.

Sub test()
With Sheets("Order")
.Range("A2:V200").Delete
With Sheets("OrderPrep").Range("B3:U29")
.MergeCells = False
.Copy
End With
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With
End Sub


--


Gary


wrote in message
...
On Sep 4, 2:42 pm, wrote:
On Sep 4, 2:30 pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:





or try this
.Range("A2:V200").Clear
instead of
.Range("A2:V200").Delete


--


Gary


wrote in message


...
On Sep 4, 1:08 pm, Gary''s Student


wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802


"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected,
but
you
say it runs on other pc's.


--


Gary


wrote in message
...
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.


Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. So it's most definately not the code but rather
something in that particular instance of excel.- Hide quoted text -


- Show quoted text -


I fixed it. The solution is simple, the reason who the hell knows.

Instead of using PasteSpecial, I just combined it into one command

with Sheets("OrderPrep")
.Range("B3:U29").Copy .Range("B1")
end with- Hide quoted text -

- Show quoted text -


I'd like to re-open this thread...

My solution above isn't good. Using the .Copy method with the
destination passed along will change references and that's not cool,
as I need it to copy the values only.

So...Does anybody have any idea why a PasteSpecial would cause erro
1004 "merged cells must be identically sized" on one instance of
excel, but not another?

thx



[email protected]

PasteSpecial giving error #1004
 
On Sep 5, 2:46*pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:
see if this, at least, works without errors.

Sub test()
* * * With Sheets("Order")
* * * * * * .Range("A2:V200").Delete
* * * * * * With Sheets("OrderPrep").Range("B3:U29")
* * * * * * * * * .MergeCells = False
* * * * * * * * * .Copy
* * * * * * End With
* * * * * * .Range("B1").PasteSpecial xlPasteValues
* * * * * * .Range("B1").PasteSpecial xlPasteFormats
* * * End With
End Sub

--

Gary

wrote in message

...
On Sep 4, 2:42 pm, wrote:





On Sep 4, 2:30 pm, "Gary Keramidas" <GKeramidasATmsn.com wrote:


or try this
.Range("A2:V200").Clear
instead of
.Range("A2:V200").Delete


--


Gary


wrote in message


....
On Sep 4, 1:08 pm, Gary''s Student


wrote:
Might be that the personal.xls on one of the computers is somehow screwing
things up??
--
Gary''s Student - gsnu200802


"Gary Keramidas" wrote:
works here, i know you can get a 1004 error if the sheet's protected,
but
you
say it runs on other pc's.


--


Gary


wrote in message
...
Hi,


I have a weird problem. I've created a workbook that dozens of sales
people use. One laptop, which is the exact same configuration as all
of the others, is having a problem running my code.


With Sheets("Order")
.Range("A2:V200").Delete


Sheets("OrderPrep").Range("B3:U29").Copy
.Range("B1").PasteSpecial xlPasteValues
.Range("B1").PasteSpecial xlPasteFormats
End With


It's not this specific piece of code; it happens with EVERY
pastespecial that this laptop runs. I can't figure it out!


any suggestions?


thx- Hide quoted text -


- Show quoted text -


Just chcked and there's nothing unusual being loaded from the
XLSTARTUP, etc folders.


Also, I tried to run the code as if I was doing it manually (selected
some cells, went to a new sheet, edit, paste special) and it gave me
the same error. So it's most definately not the code but rather
something in that particular instance of excel.- Hide quoted text -


- Show quoted text -


I fixed it. The solution is simple, the reason who the hell knows.


Instead of using PasteSpecial, I just combined it into one command


with Sheets("OrderPrep")
.Range("B3:U29").Copy .Range("B1")
end with- Hide quoted text -


- Show quoted text -


I'd like to re-open this thread...

My solution above isn't good. *Using the .Copy method with the
destination passed along will change references and that's not cool,
as I need it to copy the values only.

So...Does anybody have any idea why a PasteSpecial would cause erro
1004 "merged cells must be identically sized" on one instance of
excel, but not another?

thx- Hide quoted text -

- Show quoted text -


It didn't work. However, I do have something interesting to report.
When I run that code in a new book, it works. When I put that code
into the existing workbook, it fails.

That means it's something to do specifically with the laptop AND the
workbook.

Now I'm even more lost.


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com