Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy/paste: strange feature (I think)
I just found that the result of a horizontal Paste can take 2 forms depending
on the relation of the number of copied columns to the number of columns in the destination range: €¢ If the number of destination columns eg 16384 is divisible without remainder by the number of copied columns eg 32 (result = 512) then the copied columns will be pasted 512 times next to each other, covering the whole destination range. €¢ Otherwise they will be pasted only exactly once padded with empty cells at the right. Being a coding novice I created below piece of code with the intention to paste the copied range only once but it does it 512 times. How can I improve my code? Sheets("Sheet1").Range("A10:AF10").Copy Sheets("Sheet2").Rows(1).PasteSpecial (xlPasteValues) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy/paste: strange feature (I think)
The code that you posted tells it to paste the clipboard contents to the
entire row. So in xl2003, it would paste from A1 to IV1. So, in xl2007 it would be considerably more. It is doing exactly what the code calls for. If you want it to only paste the same amount as that copied, then use a single cell reference for the upper left corner anchor, or use and exact range match for the size of the copied range. "Michael R" wrote in message ... I just found that the result of a horizontal Paste can take 2 forms depending on the relation of the number of copied columns to the number of columns in the destination range: . If the number of destination columns eg 16384 is divisible without remainder by the number of copied columns eg 32 (result = 512) then the copied columns will be pasted 512 times next to each other, covering the whole destination range. . Otherwise they will be pasted only exactly once padded with empty cells at the right. Being a coding novice I created below piece of code with the intention to paste the copied range only once but it does it 512 times. How can I improve my code? Sheets("Sheet1").Range("A10:AF10").Copy Sheets("Sheet2").Rows(1).PasteSpecial (xlPasteValues) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find Feature and Paste Link | Excel Discussion (Misc queries) | |||
Using Paste Feature with out Activating Sheet | Excel Programming | |||
Strange Copy/Paste behavior | Excel Discussion (Misc queries) | |||
Copy/paste from Win SQL gives strange characters | Excel Discussion (Misc queries) | |||
Strange copy & paste behavior | Excel Discussion (Misc queries) |