Skip to content

Instantly share code, notes, and snippets.

@spiridenok
Created August 5, 2013 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spiridenok/6154707 to your computer and use it in GitHub Desktop.
Save spiridenok/6154707 to your computer and use it in GitHub Desktop.
VBA: replace last occurrence of a string within a string
' replace only the LAST occurrence of a the SEARCH substring in SOURCE
' with the REPLACESTR string - search isn't case-sensitive
ReplaceLast = StrReverse(Replace(StrReverse(Source), StrReverse(Search), StrReverse(ReplaceStr), , 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment