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: 1
Default Speed of REPLACE-just curious


Can someone explain why the use of REPLACE in VBA is lightening fast
relative to normal looping? The marked disparity in the speed of
execution of the following 2 codes highlights the point.


Sub ReplaceFunction()
Range("A1: BQ5000").Replace, "ALPHA", "BETA", xlWhole
End sub

Sub ReplaceViaLoop()
Dim c as Range

For each c in Range("a1:bq5000")
if c.value="ALPHA" then
c,value ="BETA"
end if
next

End Sub

Surely the underlyng code of the REPLACE function must be attempting
some looping, whatever the language used (VB6?). I don't wish to
believe that VBA is intrincically slower than VB6.

Myles


--
Myles
------------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...o&userid=28746
View this thread: http://www.excelforum.com/showthread...hreadid=572341

 
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
Speed of Replace Range Monk[_2_] Excel Discussion (Misc queries) 6 May 24th 08 04:57 AM
how to speed Find/Replace in Excel(Using VB) replace one tag in content of one cell a[_2_] Excel Programming 4 January 18th 06 09:16 AM
Optimizing a macro for speed- find and replace trickdos[_20_] Excel Programming 2 November 12th 04 10:21 PM
Optimizing a macro for speed- find and replace trickdos[_19_] Excel Programming 3 November 12th 04 12:41 AM
Just Curious Mike Fogleman Excel Programming 7 September 30th 04 08:04 AM


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