LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 279
Default Optimising loop: was Merging cells and formats

In message of Mon, 6 Jan 2014 13:08:59 in
microsoft.public.excel.worksheet.functions, GS
writes
For clarity, to resist my 'force-of-habit' the entire procedure need
not have events disable as Claus's 3rd post holds true...


[snip]

My thanks to both GS and Claus Busch for their valuable thoughts.
Eventually, I decided to write a VBA procedure to fill a column and
embolden parts of the cells.
At first, I had a loop which did both.
That was unhelpful.
Suppose I concatenate strings "A", "B" and "C" in that order and decide
to embolden "B" with code like
Cells(y, x).Characters(Start:=2, Length:=1).Font.Bold = True.
When "C" is concatenated, it is also emboldened as the appended
characters copy the bold attribute from that "B".

I then found my code slow: about 130 seconds for 1300 rows.
I carefully simplified the code with no noticeable result.
I then googled excel vba optimisation.
The first 2 hits were
<www.cpearson.com/excel/optimize.htm and
<http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm
Chuck Pearson's site is a gold mine and the Ozgrid site looks useful.
I tried bracketing code with
Application.Calculation = xlCalculationManual and
Application.Calculation = xlCalculationAutomatic
and with
Application.ScreenUpdating = False and
Application.ScreenUpdating = True
The result is that my code runs in 1 to 2 seconds.

That is fast enough. I can't publish as the data is confidential.
--
Walter Briscoe

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

 
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
Merging Book Lists That Are In Different Formats andypix46 Excel Worksheet Functions 2 May 5th 12 12:15 PM
merging cells and eliminating spaces for empty cells Jill Excel Discussion (Misc queries) 2 April 2nd 10 07:43 PM
merging cells together but keeping all data from the cells Pete C[_2_] Excel Discussion (Misc queries) 3 May 16th 08 10:14 PM
"Too Many Cell Formats" when merging files Chad Ginther Excel Programming 1 September 2nd 07 04:41 AM
Can you retain different text formats when merging text? Genmon Excel Discussion (Misc queries) 1 January 20th 05 05:09 PM


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