Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Improve the speed of copy-paste

Hi!
I try to copy and paste a range and it's very long since there's a lot of
formula inside. Is there a way to improve the speed. I'm in manual
calculation.
Thanks!
Alex
time1 = Timer
a = Sheets("CALCULATIONS").Cells(5, 3) * 20 + 5
Sheets("PROJ RESULTS STOCHASTIC").Select
Range("C6:C25").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("C26:C" & a).Select
ActiveSheet.Paste
Sheets("PROJ RESULTS STOCHASTIC").Calculate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
MsgBox (Timer - time1) 'Takes 600 sec.
--
Alex St-Pierre
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Improve the speed of copy-paste

Try using

activesheet.calculation = false (at beginning)
activesheet.calculation = true (at end)

or

application.screenupdating = false (at beginning)
application.screenupdating = true (at end)

Or both.

"Alex St-Pierre" wrote:

Hi!
I try to copy and paste a range and it's very long since there's a lot of
formula inside. Is there a way to improve the speed. I'm in manual
calculation.
Thanks!
Alex
time1 = Timer
a = Sheets("CALCULATIONS").Cells(5, 3) * 20 + 5
Sheets("PROJ RESULTS STOCHASTIC").Select
Range("C6:C25").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("C26:C" & a).Select
ActiveSheet.Paste
Sheets("PROJ RESULTS STOCHASTIC").Calculate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
MsgBox (Timer - time1) 'Takes 600 sec.
--
Alex St-Pierre

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Improve the speed of copy-paste

I'm a bit confused as to why you first paste the range to the same sheet and
then paste the values to another.
This idea is very fast. It is a one liner that uses NO selections and can be
fired from anywhere in the wb.
Notice that the ranges must be the same size.

sheets("destination").range("a12:x16").value =
sheets("source").range("a2:x6").value

or this idea. Modify to suit.

lc=sheets("source").range("a2").end(xltoright).col umn
lr=sheets("source").range("a2").end(xldown).row
sheets("destination").range(cells(lr+10,"a"),cell( lr+10,lc)).value = _
sheets("source").range(cells(lr,"a"),cell(lr,lc)). value
--
Don Guillett
SalesAid Software

"Alex St-Pierre" wrote in message
...
Hi!
I try to copy and paste a range and it's very long since there's a lot of
formula inside. Is there a way to improve the speed. I'm in manual
calculation.
Thanks!
Alex
time1 = Timer
a = Sheets("CALCULATIONS").Cells(5, 3) * 20 + 5
Sheets("PROJ RESULTS STOCHASTIC").Select
Range("C6:C25").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("C26:C" & a).Select
ActiveSheet.Paste
Sheets("PROJ RESULTS STOCHASTIC").Calculate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
MsgBox (Timer - time1) 'Takes 600 sec.
--
Alex St-Pierre



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Improve the speed of copy-paste

The continuation char didn't make it. Space and underscore to make one line
two.

sheets("destination").range("a12:x16").value = _
sheets("source").range("a2:x6").value


--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
I'm a bit confused as to why you first paste the range to the same sheet
and then paste the values to another.
This idea is very fast. It is a one liner that uses NO selections and can
be fired from anywhere in the wb.
Notice that the ranges must be the same size.

sheets("destination").range("a12:x16").value =
sheets("source").range("a2:x6").value

or this idea. Modify to suit.

lc=sheets("source").range("a2").end(xltoright).col umn
lr=sheets("source").range("a2").end(xldown).row
sheets("destination").range(cells(lr+10,"a"),cell( lr+10,lc)).value = _
sheets("source").range(cells(lr,"a"),cell(lr,lc)). value
--
Don Guillett
SalesAid Software

"Alex St-Pierre" wrote in message
...
Hi!
I try to copy and paste a range and it's very long since there's a lot of
formula inside. Is there a way to improve the speed. I'm in manual
calculation.
Thanks!
Alex
time1 = Timer
a = Sheets("CALCULATIONS").Cells(5, 3) * 20 + 5
Sheets("PROJ RESULTS STOCHASTIC").Select
Range("C6:C25").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("C26:C" & a).Select
ActiveSheet.Paste
Sheets("PROJ RESULTS STOCHASTIC").Calculate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
MsgBox (Timer - time1) 'Takes 600 sec.
--
Alex St-Pierre





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
Improve speed of saving a large Excel file Elmer Excel Discussion (Misc queries) 3 February 5th 07 07:15 AM
Improve Speed by desabling Automatic Calculation Alex St-Pierre Excel Programming 4 March 14th 06 03:55 PM
Using an Array instead of a Vlookup to improve speed Frank & Pam Hayes[_2_] Excel Programming 4 August 10th 05 08:01 PM
How can I Improve query speed? John[_60_] Excel Programming 5 October 12th 04 01:00 PM
Howto Improve speed? Andy Excel Programming 0 January 19th 04 04:39 PM


All times are GMT +1. The time now is 07:50 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"