Excel 97 Macro

boydr

Board Regular
Joined
Apr 17, 2002
Messages
157
Could someone tell me why that when I try to copy the value of a cell from one sheet to another, the macro runs fine, but nothing gets copied? The source range contains a formula, but I just want the values copied over.

Another problem I have: , for example, I'm trying to copy the range A1:C1 on sheet1 to D4:F4 on sheet2 and it says that the cells aren't the same size. Does the column width have to be the same size? I'm coping from a range of 3 cells to another range of 3 cells but I don't get it.
This message was edited by boydr on 2002-04-28 18:07
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Regarding the first part of your post, the best thing you could do is post your code so we can see what is happening, and then make recommendations. I suspect that all you should have to do is to select the upper left cell of the destination range, instead of the entire destination range, and that might clear up that issue, unless I'm not understanding your problem.

Regarding the second half of your post, try this approach:

Sub CopyIt()
Sheet2.Range("D4:F4").Value = Sheet1.Range("A1:C1").Value
End Sub

Any help?
 
Upvote 0
I do have merged cells on both the source and destination. Why would that present a problem?
 
Upvote 0
I think it is because when a cell is merged Excel can't figure out which of the merged cells you want to paste to, but if the merged cells are in the same sequence instead of pasting to the whole range ie D4:F4 just paste to D4 and it should work.
for example if A1 and B1 are merged and D4 and E4 are merged then copying A1:C1 and pasting to just D4 will work correctly. If however the merged cells do not line up then the merged cells on the destination sheet will be changed to match the originating sheet.

Cheers,
Alan.
 
Upvote 0
Thanks. I'll give it a shot in a day or two. I'm so busy I can't think straight right now.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top