Replacing character in a given string

mandukes

Forum Rules
Joined
May 25, 2013
Messages
90
Hi, I need to insert character in between a given string by replacing the character in the given string.


Here is an example:

Str = "ABTXDFATGTHYFL"

Replacing A with Z

So, the output would be "ZBTXDFZTGTHYFL"


Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi, I need to insert character in between a given string by replacing the character in the given string.

Here is an example:

Str = "ABTXDFATGTHYFL"

Replacing A with Z

So, the output would be "ZBTXDFZTGTHYFL"

Thanks
Str is not a good name to use for a variable as that is the name of a built-in VB function. With that said, if...

Str = "ABTXDFATGTHYFL"

Then to "fix" it...

Str = Replace(Str, "A", "Z")
 
Upvote 0
Type str into the Immediate Window and then, with the text cursor in or next to the word, press the F1 key and you will see the help page for the Str function.

AAh, funny the VBA intelligence does not recognize Str() as I type it. but it sure does works ;) Thanks for pointing this out.

BTW, I,m using office 2016 X64
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,858
Members
449,194
Latest member
HellScout

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