Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Error 1004 when pasting - Hair pulling time

Hi,
I am really pulling my hair out.
I am getting the following error:
"The information cannot be pasted because the Copy area and the paste
area are not the same size and shape. Try one of the following:
1.) Click a single cell, and then paste.
2.) Select a rectangle that's the same size and shape, and then paste.

The thing is, the code works fine on Excel 2002, but errors only on Excel 97
- unfortunately we have a mixed environment that I can't do anything about.
The same sheets are being used, so surely the same should occur in both
versions!?

Has anyone come accross this before? Needless to say

The code is:
'4. Copy the source range
wsWorking.Range(sWorkingRange).Copy
Debug.Print wsWorking.Range(sWorkingRange).Rows.Count

'5. Paste / insert the range into the target front sheet
wsIYM.Activate
sRange = "A" & iCurrentInsertPoint & ":R" & iCurrentInsertPoint
wsIYM.Range(sRange).Select
Selection.EntireRow.Insert shift:=xlDown '##Error This line on Excel 97 only


Many thanks in advance.
Andy
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Error 1004 when pasting - Hair pulling time

hi,
per your code you are selecting a range and trying to
insert it into a row.(even though you are shifting. excel
is seeing the row and displays error before it gets to the
insert) that is your problem.
where as that may work in 2k, the same procedure doesn't
seem to work in 97. that is a common problem when writing
code in i version and running it in another.
another thing. your code is not pasting. it is inserting.
there is a difference.
i would re-write the code to use the copy and paste.
wsIYM.Range(sRange).Select
Activesheet.paste
Application.CutCopyMode = False

-----Original Message-----
Hi,
I am really pulling my hair out.
I am getting the following error:
"The information cannot be pasted because the Copy area

and the paste
area are not the same size and shape. Try one of the

following:
1.) Click a single cell, and then paste.
2.) Select a rectangle that's the same size and shape,

and then paste.

The thing is, the code works fine on Excel 2002, but

errors only on Excel 97
- unfortunately we have a mixed environment that I can't

do anything about.
The same sheets are being used, so surely the same should

occur in both
versions!?

Has anyone come accross this before? Needless to say

The code is:
'4. Copy the source range
wsWorking.Range(sWorkingRange).Copy
Debug.Print wsWorking.Range(sWorkingRange).Rows.Count

'5. Paste / insert the range into the target front sheet
wsIYM.Activate
sRange = "A" & iCurrentInsertPoint & ":R" &

iCurrentInsertPoint
wsIYM.Range(sRange).Select
Selection.EntireRow.Insert shift:=xlDown '##Error This

line on Excel 97 only


Many thanks in advance.
Andy
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Error 1004 when pasting - Hair pulling time

Dear Anonymous..
Many thanks for that, its very helpful and almost there.
What can I do so that it shifts existing rows down, rather than overwriting
them?
i.e. has the same effect as "shift:=xlDown" with the insert statement

Many thanks
Andy

" wrote:

hi,
per your code you are selecting a range and trying to
insert it into a row.(even though you are shifting. excel
is seeing the row and displays error before it gets to the
insert) that is your problem.
where as that may work in 2k, the same procedure doesn't
seem to work in 97. that is a common problem when writing
code in i version and running it in another.
another thing. your code is not pasting. it is inserting.
there is a difference.
i would re-write the code to use the copy and paste.
wsIYM.Range(sRange).Select
Activesheet.paste
Application.CutCopyMode = False

-----Original Message-----
Hi,
I am really pulling my hair out.
I am getting the following error:
"The information cannot be pasted because the Copy area

and the paste
area are not the same size and shape. Try one of the

following:
1.) Click a single cell, and then paste.
2.) Select a rectangle that's the same size and shape,

and then paste.

The thing is, the code works fine on Excel 2002, but

errors only on Excel 97
- unfortunately we have a mixed environment that I can't

do anything about.
The same sheets are being used, so surely the same should

occur in both
versions!?

Has anyone come accross this before? Needless to say

The code is:
'4. Copy the source range
wsWorking.Range(sWorkingRange).Copy
Debug.Print wsWorking.Range(sWorkingRange).Rows.Count

'5. Paste / insert the range into the target front sheet
wsIYM.Activate
sRange = "A" & iCurrentInsertPoint & ":R" &

iCurrentInsertPoint
wsIYM.Range(sRange).Select
Selection.EntireRow.Insert shift:=xlDown '##Error This

line on Excel 97 only


Many thanks in advance.
Andy
.


  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Error 1004 when pasting - Hair pulling time

hi again,
I don't think you can to that in xl97. that was a new
thing in xl2k. Are you trying to paste data in between
other data? if you are then you may have to find a way to
expand the range before the paste.(in xl97)
and i think the "entirerow" part of your code is going to
give you problems either way.(in xl97) the data range
still would not fit.
without seeing your data and more on the code and know
more about what you are doing, i would be learly of trying
to give you specific advice.

-----Original Message-----
Dear Anonymous..
Many thanks for that, its very helpful and almost there.
What can I do so that it shifts existing rows down,

rather than overwriting
them?
i.e. has the same effect as "shift:=xlDown" with the

insert statement

Many thanks
Andy

" wrote:

hi,
per your code you are selecting a range and trying to
insert it into a row.(even though you are shifting.

excel
is seeing the row and displays error before it gets to

the
insert) that is your problem.
where as that may work in 2k, the same procedure

doesn't
seem to work in 97. that is a common problem when

writing
code in i version and running it in another.
another thing. your code is not pasting. it is

inserting.
there is a difference.
i would re-write the code to use the copy and paste.
wsIYM.Range(sRange).Select
Activesheet.paste
Application.CutCopyMode = False

-----Original Message-----
Hi,
I am really pulling my hair out.
I am getting the following error:
"The information cannot be pasted because the Copy

area
and the paste
area are not the same size and shape. Try one of the

following:
1.) Click a single cell, and then paste.
2.) Select a rectangle that's the same size and shape,

and then paste.

The thing is, the code works fine on Excel 2002, but

errors only on Excel 97
- unfortunately we have a mixed environment that I

can't
do anything about.
The same sheets are being used, so surely the same

should
occur in both
versions!?

Has anyone come accross this before? Needless to say

The code is:
'4. Copy the source range
wsWorking.Range(sWorkingRange).Copy
Debug.Print wsWorking.Range(sWorkingRange).Rows.Count

'5. Paste / insert the range into the target front

sheet
wsIYM.Activate
sRange = "A" & iCurrentInsertPoint & ":R" &

iCurrentInsertPoint
wsIYM.Range(sRange).Select
Selection.EntireRow.Insert shift:=xlDown '##Error This

line on Excel 97 only


Many thanks in advance.
Andy
.


.

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
Pulling my hair out here gtg689a Excel Worksheet Functions 0 April 5th 06 03:42 PM
Excel 1004 Error When Pasting Special W/ Macro setoFairfax Excel Discussion (Misc queries) 2 April 27th 05 02:28 PM
Pulling hair out with VLOOKUP Confused Excel Worksheet Functions 5 November 22nd 04 05:05 PM
Hair Pulling Problem... Troy[_3_] Excel Programming 4 February 20th 04 02:21 AM
Before I lose any more hair: Run-time error '9' Rick Campbell Excel Programming 7 October 15th 03 11:42 PM


All times are GMT +1. The time now is 11:54 PM.

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"