Find and Replace VBA script for a range with exact match with quotes

Jzaik

New Member
Joined
Jun 26, 2019
Messages
44
Hi there,

I am not familiar with VBA at all. I need to replace a whole set of alpha Xpath values that look like this:

ISOXML/Pmt/CrdtrAgt/CrdtrAgtTp/Nm
ISOXML/CasePmt/Agt/Nm

I have two columns set like this with the quotes to indicate that I want the whole string changed match for match.

Col1 Col 2
"Agt" "4XDD"
"Crdtr" "76ER"
"CrdtrAgt" "YY34"
"Pmt" "UU55"
"CasePmt" "788R"
"Nm" "91TR"

I used this generic script I found online:

Code:
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Sub</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">MultiFindNReplace()</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb comments" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 130, 0) !important;">'Update 20140722</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Dim</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Rng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">As</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Range</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Dim</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">As</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Range, ReplaceRng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">As</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Range</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">xTitleId = </code><code class="vb string" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">"KutoolsforExcel"</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Set</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng = Application.Selection</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Set</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng = Application.InputBox(</code><code class="vb string" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">"Original Range "</code><code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">, xTitleId, InputRng.Address, Type:=8)</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Set</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">ReplaceRng = Application.InputBox(</code><code class="vb string" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">"Replace Range :"</code><code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">, xTitleId, Type:=8)</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Application.ScreenUpdating = </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">False</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">For</code> <code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Each</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Rng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">In</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">ReplaceRng.Columns(1).Cells</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">    </code><code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Next</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Application.ScreenUpdating = </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">True</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">End</code> <code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Sub</code>[/FONT][/COLOR]

The problem with this script is that

ISOXML/Pmt/CrdtrAgt/CrdtrAgtTp/Nm
ISOXML/CasePmt/Agt/Nm

Will be converted partly like

ISOXML/UU55/Crdtr4XDD/Crdtr4XDDTp/91TR
ISOXML/CaseUU55/4XDD/91TR


So I tried to modify the script like this:
Code:
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Sub</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">MultiFindNReplace()</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb comments" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 130, 0) !important;">'Update 20140722</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Dim</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Rng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">As</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Range</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Dim</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">As</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Range, ReplaceRng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">As</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Range</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">xTitleId = </code><code class="vb string" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">"KutoolsforExcel"</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Set</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng = Application.Selection</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Set</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">InputRng = Application.InputBox(</code><code class="vb string" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">"Original Range "</code><code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">, xTitleId, InputRng.Address, Type:=8)</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Set</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">ReplaceRng = Application.InputBox(</code><code class="vb string" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 0, 255) !important;">"Replace Range :"</code><code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">, xTitleId, Type:=8)</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Application.ScreenUpdating = </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">False</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">For</code> <code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Each</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Rng </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">In</code> <code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">ReplaceRng.Columns(1).Cells</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb spaces" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">    </code>[B]InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value & ""[/B][/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Next</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb plain" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-size: 1em !important; min-height: auto !important;">Application.ScreenUpdating = </code><code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">True</code>[/FONT][/COLOR]
[COLOR=#000000][FONT=Consolas]<code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">End</code> <code class="vb keyword" style="border-radius: 0px !important; background: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important; box-sizing: content-box !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; font-weight: bold !important; font-size: 1em !important; min-height: auto !important; color: rgb(0, 102, 153) !important;">Sub</code>[/FONT][/COLOR]

That doesn't seem to work.

If anyone knows a solution for this, it would be appreciated. Thanks.
 
This one is a compile error. "Only comments may appear after End Sub, End Function, or End Property"

And it's highlighting the end here:



Code:
ActiveSheet.Range("A1:A" & ActiveSheet.UsedRange.Rows.Count).value2 = application.WorksheetFunction.Index [B](FindN_Replace_Array, 0, 1)[/B]
 
Last edited:
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Wait a minute. I recopied the code that you may have edited. This is what I ran:

Code:
Sub place()
Application.ScreenUpdating = False: Application.Calculation = xlCalculationManual
Dim FindN_Replace_Array() As Variant, X As Long, H As Long, element As Variant, B() As Variant


FindN_Replace_Array = ActiveSheet.Range("A1:C" & ActiveSheet.UsedRange.Rows.Count).value2


B = Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 2)


For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
         
        For y = 2 To 3
        
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)
        
        Next y
    
Next X


For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
    
        For Each element In Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 2)
           
                If InStr(1, FindN_Replace_Array(X, 1), Chr(47) & element & Chr(47)) <> 0 Then
                
                    FindN_Replace_Array(X, 1) = Replace(FindN_Replace_Array(X, 1), Chr(47) & element & Chr(47), Chr(47) & FindN_Replace_Array(Application.WorksheetFunction.Match(element, B, 0), 3) & Chr(47))
                
                End If
            
        Next element
        
Next X


ActiveSheet.Range("A1:A" & ActiveSheet.UsedRange.Rows.Count).value2 = application.WorksheetFunction.Index(FindN_Replace_Array, 0, 1)


Application.ScreenUpdating = True: Application.Calculation = xlCalculationAutomatic


End Sub

It ran instantly. It partially worked.

[TABLE="width: 515"]
<colgroup><col></colgroup><tbody>[TR]
[TD]PmtInf/10028/1047/139/DtAndPlcOfBirth[/TD]
[/TR]
[TR]
[TD]PmtInf/10028/1047/139/209/BirthDt[/TD]
[/TR]
[TR]
[TD]PmtInf/10028/1047/139/209/PrvcOfBirth[/TD]
[/TR]
[TR]
[TD]PmtInf/10028/1047/139/209/CityOfBirth[/TD]
[/TR]
[TR]
[TD]PmtInf/10028/1047/139/209/CtryOfBirth[/TD]
[/TR]
[TR]
[TD]PmtInf/10028/1047/139/209/Ntlty[/TD]
[/TR]
[TR]
[TD]PmtInf/10028/1047/139/209/Prfssn[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Let me try and remove quotes and blank spaces and try this gain. This last version seems to work. Not sure why all the elements didn't get picked up. It's closer.
 
Upvote 0
Let me try and remove quotes and blank spaces and try this gain. This last version seems to work. Not sure why all the elements didn't get picked up. It's closer.
I'm already auto removing the quotes. To auto remove the spaces replace
Code:
For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
         
        For y = 2 To 3
        
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)
        
        Next y
    
Next X

with

Code:
For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
         
        For y = 2 To 3
        
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(32), vbNullString)
        
        Next y
    
Next X
You could also try and replace every A1 in the code with A2
 
Last edited:
Upvote 0
Wow, this is strange. It's picking up certain values and replacing just fine. But others are not. And I can't believe I have the data in the columns the wrong way. It's just values, I took all the formatting off. I even did a trim/clean (but I think you have that in the code). I tried it with quotes, without quotes---that should make a difference.

I even just tried replacing 6 entries.

I tried Switching to A2 but then I just shifted the rows down one space. (I hope that's what the A2 meant).
 
Upvote 0
Wow, this is strange. It's picking up certain values and replacing just fine. But others are not. And I can't believe I have the data in the columns the wrong way. It's just values, I took all the formatting off. I even did a trim/clean (but I think you have that in the code). I tried it with quotes, without quotes---that should make a difference.

I even just tried replacing 6 entries.

I tried Switching to A2 but then I just shifted the rows down one space. (I hope that's what the A2 meant).
Is it just the last values in the string?
Code:
Sub place()Application.ScreenUpdating = False: Application.Calculation = xlCalculationManual
Dim FindN_Replace_Array() As Variant, X As Long, H As Long, element2 As Variant, element As Variant, B() As Variant, T As Long


FindN_Replace_Array = ActiveSheet.Range("A2:C" & ActiveSheet.UsedRange.Rows.Count).value2


B = Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 2)


For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
         
        For y = 2 To 3
        
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(32), vbNullString)
        Next y
    
Next X


For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
    
        For Each element In Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 2)
                
                T = Application.WorksheetFunction.Match(element, B, 0)
                
                If InStr(1, FindN_Replace_Array(X, 1), Chr(47) & element & Chr(47)) <> 0 Then
                        'searches for /A/
                    FindN_Replace_Array(X, 1) = Replace(FindN_Replace_Array(X, 1), Chr(47) & element & Chr(47), Chr(47) & FindN_Replace_Array(T, 3) & Chr(47))
                
                Elseif InStr(1, FindN_Replace_Array(X, 1), Chr(47) & element) <> 0 And InStrRrev(FindN_Replace_Array(X, 1), Chr(47) & element) = Len(FindN_Replace_Array(X, 1)) - Len(element) then
                        'searches for /A   and does something if it is the last in the string
                    FindN_Replace_Array(X, 1) = Replace(FindN_Replace_Array(X, 1), Chr(47) & element, Chr(47) & FindN_Replace_Array(T, 3))
                
                End If
            
        Next element
        
Next X


ActiveSheet.Range("A2:A" & ActiveSheet.UsedRange.Rows.Count).value2 = Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 1)


Application.ScreenUpdating = True: Application.Calculation = xlCalculationAutomatic


End Sub
 
Last edited:
Upvote 0
Hang on, let me see if I can group the ones that are getting picked up. It's definitely not picking up the first 30/40. Because when I tried just the 6 entries, I pasted them on the top of Column B/C.
 
Upvote 0
Hang on, let me see if I can group the ones that are getting picked up. It's definitely not picking up the first 30/40. Because when I tried just the 6 entries, I pasted them on the top of Column B/C.

Is it possible for the final string to have spaces in it. What about what is being searched for in the original string? Do your values in column B have any spaces at all when it shouldn't (leading and ending included)?If the original string has spaces then
Replace the loop with the following if you want to only remove quotation marks
Code:
For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
         
        For y = 2 To 3
        
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)

 Next y
    
Next X
 
Last edited:
Upvote 0
Okay, I found the issue. Column B and C are fine. The code is refusing to convert the first and last values of Column A values. Everything in the middle is fine.

[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/10071/1100/125/215/1047/139/209/CtryOfBirth[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/10043/1047/135/136/SchmeNm
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/10041/1041/1080/AdrLine[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/Dbtr
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/UltmtDbtr[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Okay, I found the issue. Column B and C are fine. The code is refusing to convert the first and last values of Column A values. Everything in the middle is fine.

[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/10071/1100/125/215/1047/139/209/CtryOfBirth[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/10043/1047/135/136/SchmeNm
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/10041/1041/1080/AdrLine[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/Dbtr
[TABLE="width: 403"]
<tbody>[TR]
[TD="width: 403"]PmtInf/UltmtDbtr[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub place()
Application.ScreenUpdating = False: Application.Calculation = xlCalculationManual
Dim FindN_Replace_Array() As Variant, X As Long, H As Long, element2 As Variant, element As Variant, B() As Variant, T As Long


FindN_Replace_Array = ActiveSheet.Range("A2:C" & ActiveSheet.UsedRange.Rows.Count).value2


B = Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 2)


For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
         
        For y = 2 To 3
        
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)
            FindN_Replace_Array(X, y) = Replace(FindN_Replace_Array(X, y), Chr(34), vbNullString)
        Next y
    
Next X


For X = LBound(FindN_Replace_Array, 1) To UBound(FindN_Replace_Array, 1)
    
        For Each element In Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 2)
                
                T = Application.WorksheetFunction.Match(element, B, 0)
                
                If InStr(1, FindN_Replace_Array(X, 1), element & Chr(47)) = 1 Then
                       'searches for A/ in first position
                    FindN_Replace_Array(X, 1) = Replace(FindN_Replace_Array(X, 1), element & Chr(47), FindN_Replace_Array(T, 3) & Chr(47))
                
                ElseIf InStr(1, FindN_Replace_Array(X, 1), Chr(47) & element & Chr(47)) <> 0 Then
                        'searches for /A/
                    FindN_Replace_Array(X, 1) = Replace(FindN_Replace_Array(X, 1), Chr(47) & element & Chr(47), Chr(47) & FindN_Replace_Array(T, 3) & Chr(47))
                
                ElseIf InStrRrev(FindN_Replace_Array(X, 1), Chr(47) & element) = Len(FindN_Replace_Array(X, 1)) - Len(element) Then
                        'searches for /A   and does something if it is the last in the string
                    FindN_Replace_Array(X, 1) = Replace(FindN_Replace_Array(X, 1), Chr(47) & element, Chr(47) & FindN_Replace_Array(T, 3))
        
                End If
            
        Next element
        
Next X


ActiveSheet.Range("A2:A" & ActiveSheet.UsedRange.Rows.Count).value2 = Application.WorksheetFunction.Index(FindN_Replace_Array, 0, 1)


Application.ScreenUpdating = True: Application.Calculation = xlCalculationAutomatic


End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top