<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Copying range using VBA doesn't work correctly"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=122684#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Copying range using VBA doesn't work correctly"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=122684">bug 122684</a>
from <span class="vcard"><a class="email" href="mailto:GunnarAI@hotmail.com" title="Gunnar <GunnarAI@hotmail.com>"> <span class="fn">Gunnar</span></a>
</span></b>
<pre>Thanks!
But the code fails to remove the contents of the copied range.
rSrc = "B2:C5"
rDst = "E2"
Worksheets("Sheet1").Range(rSrc).Copy
destination:=Worksheets("Sheet2").Range(rDSt)
Worksheets("Sheet2").Range(rDst).ClearContents
rDst points to upper left corner in the destination sheet, which is cleared.
rScr and rDst are not equal!
To make it work, you need to set rDst = "E2:F5" (same size)
But anyway, it's close to a solution.
This bug cost me a lot of trouble because what was copied was changing all the
time since the selected range was random, and I couldn't get hold of what was
going on. I was close to giving up until, by luck, the selected cell had a
different background color. Viola!</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>