Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Find & Replace Very Slow in VB But Not Manually

Hi All

I have VB logic that massages a lot of data. At one point I do a find
and replace call:

Range("C5:DI186").Select
Selection.Replace What:="SUMIF", Replacement:="=SUMIF",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False

to activate some formulaes that were dormant until this time.

When the code runs this search and replace it takes a *very* long time
to execute. I have calculation set to manual and screen updating
turned off.

The weird thing is when I run my macro to the line just before the
above code (terminated with an inserted "End") for find and replace
and then run the find and replace manually - it takes no time at all -
about 1/20th of the time that my code is taking to do the same thing.

I am sure that this must have something to do with the different
settings I have turned off or on in my VB code but I have only really
set calculation to manual and screen updating off.

Any ideas why the code is running so slow? Any thoughts apprciated.

Chrisso

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Find & Replace Very Slow in VB But Not Manually


Something to experiment with...
Run it twice.
replace SUMIF with xxSUMIF
-then-
replace xxSUMIF with =SUMIF
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Chrisso"
wrote in message
Hi All
I have VB logic that massages a lot of data. At one point I do a find
and replace call:

Range("C5:DI186").Select
Selection.Replace What:="SUMIF", Replacement:="=SUMIF",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

to activate some formulaes that were dormant until this time.
When the code runs this search and replace it takes a *very* long time
to execute. I have calculation set to manual and screen updating
turned off.
The weird thing is when I run my macro to the line just before the
above code (terminated with an inserted "End") for find and replace
and then run the find and replace manually - it takes no time at all -
about 1/20th of the time that my code is taking to do the same thing.
I am sure that this must have something to do with the different
settings I have turned off or on in my VB code but I have only really
set calculation to manual and screen updating off.
Any ideas why the code is running so slow? Any thoughts apprciated.
Chrisso

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Find & Replace Very Slow in VB But Not Manually

That should have read...

replace SUMIF with SxUMIF
-then-
replace SxUMIF with =SUMIF
--
Jim Cone


"Jim Cone" XX
wrote in message
Something to experiment with...
Run it twice.
replace SUMIF with xxSUMIF
-then-
replace xxSUMIF with =SUMIF
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Find & Replace Very Slow in VB But Not Manually

Hi Jim

Thanks for the suggestion. I tried this out by there was no noticeable
decrease in execution time.

I cannot exactly understand why this takes so long but I guess it is
all the calculations that are required when I ressurect my dormant
formulaes - there are 14560 of them!

However it should only need to calculate them once which is after the
search and replace as I have calculation turned off.

Oh well - I might have to rewrite my whole approach.

Chrisso

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
Find/Replace functions VERY slow when visibility = false erickras Excel Programming 3 August 3rd 06 10:42 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
slow replace function hiwan99 Excel Worksheet Functions 3 July 6th 05 11:49 PM
How come replace is so slow? Nathan Excel Discussion (Misc queries) 2 March 23rd 05 03:33 AM
Arrays to replace very slow loops ? vbastarter Excel Programming 5 August 10th 04 07:15 PM


All times are GMT +1. The time now is 10:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"