LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Optimization question: how to bypass copy and paste

I have a Macro that copies a row of formulas, pastes it for each day of
data, calculates, and then converts to values. It does this across 22
clients in 22 different sheets. The formulas copied are array fromulas
that read from 3 sheets downloaded every day averaging 30,000 lines
each, and, therefore I convert to values to enhance performance and
make it possible to work with the data without getting bogged down
every time there's a recalc.

The problem is that the updating process is extremely slow. I have read
on this newsgroup that bypassing range selections, copying, and pasting
significanly enhances performance, but cannot figure out how to do
this. My code is shown below (Sorry the code isn't very elegant (I
largely learned vb by recording macros and trying to figure them out
after).


My question is: how can I use VB to copy row 9 (actually columns a to
cb), paste it (with formatting) into the correct row, add the date
value in col a, calculate, then paste values, all without using
..select, .copy, .paste, .pastespecial (I am assuming that this is
possible and will enhance performance significantly).

Thanks so much!


========================

For b = ptop To pbottom ' b = the row number for each entry, ptop and
pbottom calculated earlier

Rows("9:9").Copy ' copy the forumulas; always in row 9
Rows(CStr(b) + ":" + CStr(b)).Select
ActiveSheet.Paste ' Paste 1 row

' add the value for the date in question
zz = q + z 'zz= a value the date being processed, q and z
calculated earlier in the code

Range("a" + CStr(b)) = zz 'insert the value into Column (A),
variable row

' convert to value
Calculate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Next b

 
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
Table formula optimization Question urlocaljeweler Excel Discussion (Misc queries) 0 November 17th 09 11:23 PM
Copy/Paste Question DoubleZ Excel Discussion (Misc queries) 3 September 24th 08 11:13 PM
Copy/Paste question Dan Excel Worksheet Functions 0 February 22nd 07 12:55 AM
Optimization question Seeking optimization Excel Discussion (Misc queries) 2 April 26th 06 01:03 PM
Copy Paste Question lcannon Excel Discussion (Misc queries) 1 June 14th 05 12:48 AM


All times are GMT +1. The time now is 08:13 AM.

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"