View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Ming[_2_] Ming[_2_] is offline
external usenet poster
 
Posts: 14
Default How to copy/paste without using clipboard?

Hi Jocab, this is the workaround I'm trying to do now. But it is painfully
slow. Plus, it's difficult to do everything what copy/paste offers (e.g. I
didn't figure out how to duplicate formula with relative reference of cells,
and how to duplicate merged cells).

"Jacob Skaria" wrote:

To copy values try the below

Sheets("Sheet2").Range("A11:B15") = Sheets("Sheet1").Range("A1:B5").Value

OR

Dim rngTemp As Range
Set rngTemp = Sheets("Sheet1").Range("A1:B5")
Sheets("Sheet2").Range("A11").Resize( _
rngTemp.Rows.Count, rngTemp.Columns.Count) = rngTemp.Value


If this post helps click Yes
---------------
Jacob Skaria


"Ming" wrote:

Hi Mike and Jacob, thank you very much for quick responses.

Mike, I'm sorry I wasn't clear enough on my problem. The problem is that,
while Excel is working in background generating reports, user working on
foreground (e.g. writing emails or word documents) cannot use copy/paste.
Sometimes, you get wrong thing pasted if the Excel template was doing
Selection.Copy, and sometimes you don't get anything pasted if Excel was
doing Range.Copy (which clears everything in the clipboard right away). There
is also a potential that wrong thing is pasted to the Excel report. Just a
timing issue.

As I said in my initial post, Range.Copy does use clipboard - it just clears
the clipboard. You can try it out easily. Microsoft's document on that
function is wrong.

Jacob, I'm using VBA code to do that. In the code both Selection.Copy and
Range.Copy are used right now. But if there is any copy function whick
doesn't interfere with the clipboard, I would refactor my VBA code to use
that.

"Jacob Skaria" wrote:

Probably a VBA solution would help..

If this post helps click Yes
---------------
Jacob Skaria


"Ming" wrote:

I'm using Excel to generate some reports in background which could take long
time. The problem is that a lot of copy/paste is used in the template for
generating those reports which makes the Window clipboard unusable for the
user working in foreground.

There are two ways you can copy/paste data around in Excel.

One is Selection.Copy and ActiveSheet.Paste. It copies the content in
Windows clipboard which can be shared by other applications. I can understand
why this function uses clipboard.

There second way is to use Range.Copy [Destination] to copy and paste in one
function call. This function also uses clipboard. Actually, it copies into
clipboard and clears it right away. So, the content can't be shared at all.
Therefore, there is really no reason to use the clipboard. Sadly, this is the
way it behaves.

There is another similar function Worksheet.Copy [Destination] which doesn't
use clipboard.

Anybody is aware of workaround for this problem?