View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] EagleOne@discussions.microsoft.com is offline
external usenet poster
 
Posts: 391
Default Help with Replace()

Rick,

Clever! I was either blind or VBA Replace() was not operating as documented.
I am not blind.

EagleOne

"Rick Rothstein" wrote:

Replace is an odd function (in my view) in that if you specify a starting
position to do the replacement at, then it returns a substring starting at
that position before making the substitution (see the Remarks section for
the Replace function). So, to do the replace and keep the front part of the
string, you will need to concatenate it back together...

Position = 16
AfterReplacement = Left(StrToSearch, Position - 1) & Replace(StrToSearch, _
StrToFind, "", Position, , vbTextCompare)