Replace Functions not working

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

I have some code which grabs the values from some combo
boxes and concanates them togethor with underscores
between each value. This is variable 1. I then have a
replace code which examines this string looking for
spaces and replaces them with nothing, "". This is
variable 2. I then have another replace function which
looks for some specific text and replaces that if it
finds it. Variable 3. Lastly the final variable is
assigned to the value of a text box.

What is happening is the first replace function is
working but all the others are not. If i comment out the
first one, the second one works and so forth. A sample
of the code is included below.

FN1 = Division.Value & "_" & Branch.Value & "_" & _
System.Value
FN2 = Replace(FN1, " ", "") 'Remove spaces
FN3 = Replace(FN2, "Operator", "O")
FN4 = Replace(FN3, "Programmable", "P")
Sheet1.FileName.Text = FN4

What can I do so that all replace functions work. I also
wish to include more replace functions.

Thanks in advance.
 
Hello Neil,
something must be wrong with your UDF(?) replace function. Would you mind posting it?

One of the things that come to my mind: Don't you just replace the "O" in "Operator" with "O"? It looks that the function does not work, but it works. Only it does not do what you intend.
Regards
Martin
 
Back
Top